Go Down

Topic: Serial Terminal Device - Hyper Terminal Access Device (Read 1 time) previous topic - next topic


  Hello  :), I`m not new to Arduino, I have a Duemilanuove from DFRobot for 1 year and 6 months now, I love the shields and especially the display type ones, I played with the  2x16 character display, I have a serial one from Spark Fun and also HD44780 parallel ones, and my favorite the 3310 Nokia display but I always struggle with the software, I can make the demos work, make some modification in the code to show different stuff on but I cant do a new project from scratch.
My ideas for projects involve menus and displays and things that are too complicated to implement for me not knowing c++ software very well.
  So my idea is simple, in order not to implement hardware that I do not know how to use properly I want to use the serial terminal to talk to my device and make the proper modifications to it. I figure that I can make a simple menu with the "Serial.print" function and use If statement to do different stuff in the program like read a value from option 1 and turn off and on from option 2 in the menu, etc.
I have used the basis from the " SerialReceive sketch " and made some modification to it in order to show the selected item in the terminal and also subroutines for a specific selection which was easy with "if" statement.

  The problems are that the software is runing only when the terminal is connected to the device and I do not know how or where to make the program run without the terminal connected, I think i need to use this program as a secondary subroutine and also use the memory space to make and save the modification for the menu subroutines in order for them to work in the background even after i close the terminal connection.
This are some screen shots of the program and how it will be access`d by the user.

This version will only affect the blink rate of the LED on pin 13.

I want to develop this way to interact with the Arduino Device because I don't think I will  be able to make a software on the PC or a app on Android to interact with the Device in the end so with this i can conect with any Terminal program on PC like Hyper Terminal or on Android a Terminal app to connect through a com port or even a Bluetooth Com Port. 


This is the code i`m using now for this :
Code: [Select]
* SerialReceive sketch
* Blink the LED at a rate proportional to the received digit value
const int ledPin = 13; // pin the LED is connected to
int blinkRate=0; // blink rate stored in this variable
void setup()
Serial.begin(9600); // Initialize serial port to send and receive at 9600 baud
Serial.print ("** Welcome **");Serial.print ("  Ard_Text_Box v1.02");
Serial.println ();
Serial.print ("Imput serial data, with this data the "); Serial.println ();
Serial.print ("led will have diferent values to blink."); Serial.println ();
Serial.println ();
Serial.print ("__________MENIU____________"); Serial.println ();
Serial.print ("|  1. Blink rate 100      |"); Serial.println ();
Serial.print ("|  2. Blink rate 200      |"); Serial.println ();
Serial.print ("|  3. Blink rate 300      |"); Serial.println ();
Serial.print ("|  4. Blink rate 400      |"); Serial.println ();
Serial.print ("|  5. Blink rate 500      |"); Serial.println ();
Serial.print ("|  6. Blink rate 600      |"); Serial.println ();
Serial.print ("|  7. Blink rate 700      |"); Serial.println ();
Serial.print ("|  8. Blink rate 800      |"); Serial.println ();
Serial.print ("___________________________"); Serial.println ();

pinMode(ledPin, OUTPUT); // set this pin as output
void loop()
if ( Serial.available()) // Check to see if at least one character is available
char ch = Serial.read();
Serial.println ();
Serial.print ("Your selection is:"); Serial.print (ch);

if(ch >= '0' && ch <= '9') // is this an ascii digit between 0 and 9?
blinkRate = (ch - '0'); // ASCII value converted to numeric value
blinkRate = blinkRate * 100; // actual blinkrate is 100 mS times received digit
if (ch =='3')
  Serial.print ("  ATENTION !Dangerous! value");  // subrutine for the meniu 3 selection
// blink the LED with the on and off times determined by blinkRate
void blink()
delay(blinkRate); // delay depends on blinkrate value

Go Up