/* ** pushToDisplay ** ** Pushes the given data to the appropriate object described by the options provided. ** opts - OptionsStruct with details about the object to be written ** val - char* to be sent, for object types this will be converted into a uint */ int pushToDisplay (OptionsStruct opts, char *val) { int result = 0; printf("pushToDisplay: opts->objType == %d\n", opts.objType); printf("pushToDisplay: opts->value == %s\n", opts.value); if (opts.objType == strObject) { printf("writing string %d with '%s'\n", opts.objIndex, val); result = genieWriteStr(opts.objIndex, val); } else { unsigned int valInt = 0; valInt = atoi(val); if (strcmp("0", val) == 0 || valInt != 0) { printf("writing object %d type %d with '%s'\n", opts.objIndex, opts.objTypeConst, val); result = genieWriteObj(opts.objTypeConst, opts.objIndex, valInt); } else result = 1; } return result; }
void setup() { // a few options to talk to the Display, uncomment the one you want genieBegin (GENIE_SERIAL, 115200); //Serial0 //genieBegin (GENIE_SERIAL_1, 9600); //Serial1 //genieBegin (GENIE_SERIAL_2, 9600); //Serial2 //genieBegin (GENIE_SERIAL_3, 9600); //Serial3 genieAttachEventHandler(myGenieEventHandler); //Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor) pinMode(4, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset) digitalWrite(4, 1); // Reset the Display via D4 delay(100); digitalWrite(4, 0); // unReset the Display via D4 delay (3500); //let the display start up //Turn the Display on (Contrast) - (Not needed but illustrates how) genieWriteContrast(1); // 1 = Display ON, 0 = Display OFF //Write a string to the Display genieWriteStr(0, GENIE_VERSION); }