Need help with GenieArduino!

I am trying to interface a 4d systems board with an arduino uno. On visi-genie, I have a schematic with buttons on it. When a button is pressed, a new form comes up. I have to try an update the voltage and current going through the system in real time. This i am trying to do using an arduino uno.

My code is given here:

#include <SoftwareSerial.h>
#include <genieArduino.h>

Genie genie;
#define rxPin 2
#define txPin 3
#define RESETLINE 4
int voltLED1;
int sensorpin=A0;

SoftwareSerial mySerial=SoftwareSerial(rxPin,txPin);
byte pinState=0;

void setup()
{
Serial.begin(9600);
genie.Begin(Serial);

genie.AttachEventHandler(myGenieEventHandler);

pinMode(RESETLINE, OUTPUT); // Set D4 on Arduino to Output
digitalWrite(RESETLINE, 0); // Reset the Display via D4
delay(100);
digitalWrite(RESETLINE, 1); // unReset the Display via D4
delay (3500); //let the display start up after the reset (This is important)
}

void loop()
{
static long waitPeriod = millis();
genie.DoEvents(); //Genie events are received and queued here.
genie.ReadObject(GENIE_OBJ_WINBUTTON,0x00);
if (millis() >= waitPeriod)
{
voltLED1=((5.0*analogRead(sensorpin)*1000)/1023);
genie.WriteObject(GENIE_OBJ_LED_DIGITS,0x00,voltLED1); //write to Leddigits0 the value of voltLED
}
// Do a manual read from Winbutton. The results of this call will
// be available to myGenieEventHandler() after the display has responded
waitPeriod = millis()+50;
// rerun this code to update LEDdigits0 in another 50ms time.
}

void myGenieEventHandler(void)
{
int button;
genieFrame Event;
genie.DequeueEvent(&Event);
//If the cmd received is from a Reported Event (Events triggered from the Events tab of Workshop4 objects)
if (Event.reportObject.cmd == GENIE_REPORT_OBJ)
{
if (Event.reportObject.object == GENIE_OBJ_WINBUTTON)
{
if (Event.reportObject.index == 0)
{
button = genie.GetEventData(&Event);
button = !button;
genie.WriteObject(GENIE_OBJ_FORM, 0x01, 0);
}
}
else
genie.WriteObject(GENIE_OBJ_FORM,0x00,0);
}
}

I am trying to vary the voltage using a potentiometer. The problem is that when I vary the voltage, the system takes me to the main image on the lcd screen and does not update. Please help!

Hi,

Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

This will make your sketch easier to read.
Also the subject of this post, it should be something like , Help with GenieArduino

This will give forum members an idea of what you need help with, you can edit the subject yourself.

Tom..... :slight_smile:

How is the pot wired ?

One end is connected to the ground and the other one to A0.

One end is connected to the ground and the other one to A0.

Look in the playground for examples of how to read a pot they will show you the correct way to wire it!.

Mark

geek_chic123:
One end is connected to the ground and the other one to A0.

Hmmmmmm........

As suggested, you need to connect it correctly.