Home > Uncategorized > Partial LCD Support in Searduino (not complete, but ready for use)

Partial LCD Support in Searduino (not complete, but ready for use)

About Searduino (short version): C/C++ interface to your Arduino boards, build stand alone program for your local computer, run your Arduino code in a simulator. (Longer About)

The added LCD Support means you can play around with LCDs (2×16 characters) just as you can with physical Arduinos. We’ve tried to fake the behavior of “LCD Keypad Shield For Arduino” [1]. For a normal user (that is someone who does not want to write a simulator by her self) nothing needs to be done – it should work.

“Not much of the API is done – why bother to write about it?” – you may wonder!

We chose to blog about it early since need your help – join us!! 

Status

Update (Dec 29, 2013): Current status can be found here)

The LiquidCrystal API[2] offers the following functions (followed by Searduino’s implementation status

LiquidCrystal() - ok
begin() - ok
clear() 
home()
setCursor() - ok
write() - Coming up next
print() - ok
cursor()
noCursor()
blink()
noBlink()
display()
noDisplay()
scrollDisplayLeft()
scrollDisplayRight()
autoscroll()
noAutoscroll()
leftToRight()
rightToLeft()
createChar()

How to use them with Searduino’s two simulators:

You can run the example[4] that’s in the git repo.

cd example/lcd-shield
make -f Makefile.lcd-shield clean shlib

You should have a shared lib (lcd-shield.so) that you can load in Jearduino.

searduino-jearduino.sh

or as a separate program (using the default LCD functions):

make -f Makefile.lcd-shield clean prog
./lcd-shield

Jearduino

Jearduino is the GUI simulator frontend of Searduino. If you download the latest git[3] it’s all there ready to use, with a separate Panel for LCD.

Stream

Stream is the text based simulator frontend of Searduino. If you download the latest git[2] it’s all there ready to use, with a stdout printout of each LCD write.

How to use them in your own simulator:

C

uint8_t seasim_register_lcd_cb(lcd_to_sim_callback_ptr cb);
where lcd_to_sim_callback_ptr is defined as
typedef void    (*lcd_to_sim_callback_ptr)    (const char* str1, const char*str2);
so an example callback could look like this:
void
lcd_callback(const char *str1, const char *str2)
{
 printf ("LCD_CALLACK() LCD[0]: %s\n" , str1);
 printf ("LCD_CALLACK() LCD[1]: %s\n" , str2);
 fflush(stdout);  /*  MIND YOU, IS FLUSH REALLY NEEDED!!! */ 
}

Java

Implement:

SearduinoObserver

Call:

registerLCDCallback(this);

Add a callback, typically like this:

public void handleLCDEvent(String row1, String row2)
 {
 System.out.println("EVENT: LCD MESSAGE-------------> " + row1 + " " + row2 );
}

Python

Not implemented yet

… and if you’ve read this far you might as well join us

[1] http://www.dfrobot.com/index.php?route=product/product&product_id=51#.Ur1i1pCJDAQ

[2] http://arduino.cc/en/Reference/LiquidCrystal

[3] http://git.savannah.gnu.org/gitweb/?p=searduino.git;a=summary

[4] http://git.savannah.gnu.org/gitweb/?p=searduino.git;a=blob_plain;f=example/lcd-shield/lcd-shield.cpp;hb=HEAD

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: