Tutorials

  1. ALU design (lab)
  2. CPU design (lab)
  3. Assembly for MC68332 (lab)
  4. C programming:
    Servo control
    (lab)
  5. Sensors and LCD ouput (lab)
  6. DC motor control (lab)
  7. Position control of differential-drive (lab)
  8. PSD, electromagnet (lab)
  9. Camera interface (lab)
  10. Image processing (lab)
  11. Final project (lab)
  12. Review

Embedded Systems 620.220

Tutorial 5: Sensors and LCD Output

For this tutorial, you will learn how to read values from some basic sensors using the EyeBot. You will also learn how to display the data as output on the LCD. For reference, all the programming commands for the EyeBot can be found here (Click on Controller -> Libraries).

Key Input

The input from the four keys on the front of the keypad can be obtained with the functions KEYGet() and KEYRead(). The main body of your programs will probably be contained in a while loop with a keypress as a condition statement. For example

void main()
{

int key;
//Initialize other variables

key = KEYRead();

while(key != KEY4)
{

// do something
key = KEYRead();

}

}

Analog Input

To obtain analog input, use the command OSGetAD. When obtaining data from more than one channel of the A/D converter in succession, you may find that the values are identical. If this happens, insert an OSWait command between reading times, or perform other computations between samples.

LCD Output

The most useful function for debugging is probably the LCDPrintf statement. The parameters passed to the function are exactly the same as the C printf function. You will also find the LCDSetPixel, LCDGetPixel, and LCDLine functions to be useful for the drawing items on the screen.

 

Questions? Email Josh Petitt

last updated February 4, 2003 - © University of Western Australia