I am Working on VB to read Serial, i look to import MSCOM in PHP, but doesn´t work very weel.
A Question. This push Buttom will work like This:
#include <glcd.h>
#include "fonts/allFonts.h" // system and arial14 fonts are used
#include "bitmaps/allBitmaps.h" // all images in the bitmap dir
Image_t icon;
int choise;
gText textArea; // a text area to be defined later in the sketch
gText textAreaArray[3]; // an array of text areas
gText countdownArea = gText(GLCD.CenterX, GLCD.CenterY,1,1,Arial_14); // text area for countdown digits
const int buttonPin[] = {38,39,40,41,42,43}; // the number of the pushbutton pin
int pinCount =6;
int val[6];
int buttonState = 0;
unsigned long startMillis;
unsigned int loops = 0;
unsigned int iter = 0;
int theDelay = 20;
void setup()
{
int thisPin;
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(buttonPin[thisPin], INPUT);
}
GLCD.Init(); // initialise the library, non inverted writes pixels onto a clear screen
if(GLCD.Height >= 64)
icon = ArduinoIcon64x64; // the 64 pixel high icon
else
icon = ArduinoIcon64x32; // the 32 pixel high icon
GLCD.ClearScreen();
introScreen();
GLCD.SelectFont(System5x7, BLACK); // font for the default text area
}
void loop()
{
// int thisPin;
GLCD.DrawRect(0, 0, GLCD.CenterX, GLCD.Bottom); // rectangle in left side of screen
GLCD.DrawRoundRect(GLCD.CenterX + 2, 0, GLCD.CenterX - 3, GLCD.Bottom, 5); // rounded rectangle around text area
for(int i=0; i < GLCD.Bottom; i += 4)
GLCD.CursorToXY(GLCD.CenterX/2, GLCD.Bottom -15);
GLCD.CursorTo(0,0);
GLCD.print("Pastelaria\n\n");
GLCD.CursorTo(0,3);
GLCD.print("Cafetaria\n\n");
GLCD.CursorTo(0,6);
GLCD.print("Cozinha\n\n");
GLCD.CursorToXY(GLCD.CenterX + 16, 9);
GLCD.print("Clique");
GLCD.SelectFont(System5x7, BLACK);
GLCD.CursorToXY(GLCD.CenterX + 4, 24);
GLCD.print("no Botao");
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
val[thisPin] = digitalRead(buttonPin[thisPin]);
if (buttonPin[0]== HIGH){
Serial.println("Pastelaria");
choise=0;
scrollingDemo();
}else if(buttonPin[1]== HIGH){
Serial.println("Cafetaria");
choise=1;
scrollingDemo();
}else if(buttonPin[3]== HIGH){
Serial.println("Restaurante");
choise=2;
scrollingDemo();
}
}
}
void introScreen(){
GLCD.DrawBitmap(icon, 32,0); //draw the bitmap at the given x,y position
countdown(3);
GLCD.ClearScreen();
GLCD.SelectFont(System5x7, BLACK); // you can also make your own fonts, see playground for details
GLCD.CursorToXY(GLCD.Width/2 - 44, 3);
GLCD.print("Ementa Electronica");
countdown(3);
GLCD.ClearScreen();
}
void countdown(int count){
while(count--){ // do countdown
countdownArea.ClearArea();
countdownArea.print(count);
delay(1000);
}
}
void scrollingDemo(){
GLCD.ClearScreen();
// int choise=-1;
switch (choise) {
case 0:
GLCD.CursorTo(0,0);
GLCD.print("Bolo de Arroz\n");
GLCD.CursorTo(0,3);
GLCD.print("Nata\n");
GLCD.CursorTo(0,6);
GLCD.print("Bispo\n");
break;
case 1:
GLCD.CursorTo(0,1);
GLCD.print("1=Cafe\n");
GLCD.CursorTo(0,2);
GLCD.print("2=Galao\n");
GLCD.CursorTo(0,4);
GLCD.print("3=Descafenado\n");
break;
case 2:
GLCD.ClearScreen();
GLCD.CursorTo(2,1);
GLCD.print("1=Frango\n");
GLCD.CursorTo(3,2);
GLCD.print("2=Natas\n");
GLCD.CursorTo(4,3);
GLCD.print("3=Salada\n");
break;
}
}