Just got my 96-g2 display working (on an arduino) with the example "hello world" code thanks to some great help from the forum moderator. I would now like to take information from a simple photo resistor and send the values to the screen. It seems I can't use Display.putstr to send the data to the screen. How should I proceed? Here is my edited code:
*/
// include 4D Systems Goldelox library for Arduino
#include <Goldelox_Const4D.h>
#include <Goldelox_Const4DSerial.h>
#include <Goldelox_Serial_4DLib.h>
#include <Goldelox_Types4D.h>
#define DisplaySerial Serial // define display serial port0
Goldelox_Serial_4DLib Display(&DisplaySerial); // declare this serial port
void setup(void)
{
//Reset the display, assuming Display is connected to Arduino via 4D Arduino Adaptor Shield
pinMode(2, OUTPUT); // D2 on Arduino resets the Display
digitalWrite(2, HIGH); // Reset Display
delay(100); // 100ms Reset pulse
digitalWrite(2, LOW); // Disable Reset
delay(3000); // Allow time for the display to initialize before communicating
Display.TimeLimit4D = 5000 ; // 5 second timeout on all commands
DisplaySerial.begin(9600) ; // initialize serial port and set Baud Rate to 9,600
Display.gfx_Cls() ; // clear display
//
// Below this comment is the first string to be serially sent to the display.
//
Display.putstr("Light:\n\n") ; // send "Light:" string to display
//
}
void loop() {
int sensorValue = analogRead(A0);
Display.txt_MoveCursor(7,1);
Display.putstr(sensorValue); //Having difficulty here!
delay(2000);
}
Thank you!
Jordan
*/
// include 4D Systems Goldelox library for Arduino
#include <Goldelox_Const4D.h>
#include <Goldelox_Const4DSerial.h>
#include <Goldelox_Serial_4DLib.h>
#include <Goldelox_Types4D.h>
#define DisplaySerial Serial // define display serial port0
Goldelox_Serial_4DLib Display(&DisplaySerial); // declare this serial port
void setup(void)
{
//Reset the display, assuming Display is connected to Arduino via 4D Arduino Adaptor Shield
pinMode(2, OUTPUT); // D2 on Arduino resets the Display
digitalWrite(2, HIGH); // Reset Display
delay(100); // 100ms Reset pulse
digitalWrite(2, LOW); // Disable Reset
delay(3000); // Allow time for the display to initialize before communicating
Display.TimeLimit4D = 5000 ; // 5 second timeout on all commands
DisplaySerial.begin(9600) ; // initialize serial port and set Baud Rate to 9,600
Display.gfx_Cls() ; // clear display
//
// Below this comment is the first string to be serially sent to the display.
//
Display.putstr("Light:\n\n") ; // send "Light:" string to display
//
}
void loop() {
int sensorValue = analogRead(A0);
Display.txt_MoveCursor(7,1);
Display.putstr(sensorValue); //Having difficulty here!
delay(2000);
}
Thank you!
Jordan
Comment