Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define CHAR_ESC "\x1B"
- int x;
- int y;
- void setup()
- {
- Serial.begin(57600); // set to 57600 baud
- screen_clear();
- cursor_show(false);
- }
- void loop()
- {
- x = map(analogRead(0), 0, 1023, 0, 25); // determine x from the pot
- y = map(analogRead(1), 0, 1023, 0, 38); // determine y from the pot
- cursor_move( x , y ) ; // move to those coordinates
- Serial.print( '\xDB' ) ; // draw a block
- }
- // Helper functions from the TellyMate example code:
- void cursor_move( uint8_t row , uint8_t col )
- { // <ESC>Yrc
- Serial.print( CHAR_ESC "Y" ) ;
- Serial.print((unsigned char)(32 + row)) ;
- Serial.print((unsigned char)(32 + col)) ;
- }
- void cursor_show( bool show )
- { // <ESC>e or <ESC>f
- Serial.print( CHAR_ESC ) ;
- Serial.print( show?'e':'f' ) ;
- }
- void screen_clear( void )
- { // <ESC>E
- Serial.print( CHAR_ESC "E" );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement