void setup() { // Init the WiServer with our sendPage function that we defined above Serial.begin(9200); Serial.println("Loading.."); // Output some bits and peices to screen lcd.init(); lcd.clear(); lcd.cursorTo(1,0); lcd.printIn("Wireless LCD Shield"); lcd.cursorTo(2,0); lcd.printIn("MilesBurton.com 2009"); lcd.cursorTo(3,0); lcd.printIn("Powered by WiShield"); lcd.cursorTo(4,0); lcd.printIn("Loading..."); // Initalise and connect Wifi WiServer.init(sendPage); // Confirm we're finished loading Serial.println("Finished loading..."); // Update the LCD lcd.cursorTo(4,0); lcd.printIn("Ready..."); }
void setup() { pinMode(13, OUTPUT); //we'll use the debug LED to output a heartbeat pinMode(sig, OUTPUT); lcd.init(); //optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init() //lcd.commandWrite(0x0F);//cursor on, display on, blink on. (nasty!) lcd.clear(); val = analogRead(potPin); sprintf(buffer,"%4d",val); lcd.printIn("Poti:"); lcd.cursorTo(1, 10); lcd.printIn(buffer); }
void logoScreen() { int copywrite[] = { 128,159,145,149,151,149,145,159 }; // (c) symbol defineCharacter(1, copywrite); // screen one. lcd.clear(); moveToChar(1,0); lcd.printIn("PerLCD v1.0"); moveToChar(2,0); lcd.print(1); lcd.printIn(" kevin montuori"); delay(2000); lcd.clear(); }
void writeString(char *data) { char *tokens[MAX_DATA_SIZE]; int toks = tokenizeData(tokens); if (toks == 3) { moveToChar(atoi(tokens[0]), atoi(tokens[1])); lcd.printIn(tokens[2]); } }
// do something... void dispatchCommand() { int commandNumber = atoi(commandBuffer); if (DEBUG) { Serial.print("command buffer is: "); Serial.println(commandBuffer); Serial.println("accumulated data:"); Serial.println(dataBuffer); } int dataAsInt; switch (commandNumber) { case CLEAR: clearLineHistory(); lcd.clear(); break; case ROW_ONE_TEXT: writeLine(1, dataBuffer); break; case ROW_TWO_TEXT: writeLine(2, dataBuffer); break; case PLACE_STRING: writeString(dataBuffer); break; case WRITE_ASCII: writeAscii(dataBuffer); break; case SCROLL_LEFT: dataAsInt = atoi(dataBuffer); dataAsInt > 0 ? dataAsInt : DEFAULT_SCROLL_DELAY; lcd.leftScroll(LINE_SIZE, dataAsInt > 0 ? dataAsInt : DEFAULT_SCROLL_DELAY); lcd.clear(); // should i or not? break; case SCROLL_UP: writeLine(1, lineHistory[2]); writeLine(2, dataBuffer); break; case MAKE_CHAR: recvCharData(); break; case SET_GAUGE: setGauge(); break; case SEND_CMD: lcd.commandWrite(atoi(dataBuffer)); break; case PRINT: lcd.print(atoi(dataBuffer)); break; case RESET: clearLineHistory(); resetGauges(); lcd.clear(); break; default: lcd.clear(); lcd.printIn("Undef'd Command"); } }
void loop() { val = analogRead(potPin); if (val != valOld) { lcd.cursorTo(1, 10); sprintf(buffer,"%4d",val); lcd.printIn(buffer); } valOld= val; /***** sending the dmx signal *****/ // sending the break (the break can be between 88us and 1sec) digitalWrite(sig, LOW); delay(val); // sending the start byte shiftDmxOut(sig, 0); for (int count = 1; count <= 512; count++) { shiftDmxOut(sig, value[count]); } /***** sending the dmx signal end *****/ value[1] += valueadd[1]; if ((value[1] <= 0) || (value[1] >= 250)) { valueadd[1] *= -1; } value[2] += valueadd[2]; if ((value[2] <= 0) || (value[2] >= 250)) { valueadd[2] *= -1; } value[3] += valueadd[3]; if ((value[3] <= 0) || (value[3] >= 250)) { valueadd[3] *= -1; } value[4] += valueadd[4]; if ((value[4] <= 0) || (value[4] >= 250)) { valueadd[4] *= -1; } }
// writes msg to required line void lcd_print(byte line, char *msg) { byte i; lcd.cursorTo(line + 1, 0); lcd.printIn(msg); }