Hello together,
At first I'm trying to descripe what I'm trying to do.
I have created a simple program in ViSi Genie with a DipSwitch, my goal was it to shine a LED.
So I have inserted a DipSwitch, how u can see in the picture below.

My next step was to migrate the ViSi Genie into a ViSi code.
Trough this step i got the code to make changes.
Because I'm not so familar with programing, I have tried to use your could which I have found in one of your PDF's.
bus_Set(0x00); //set all GPIO bus pins as outputs
bus_Out(0x00); //then set them to low
repeat
state := touch_Get(TOUCH_STATUS);
if(state == TOUCH_RELEASED)
n := img_Touched(hndl,iDipswitch1);
if(n == iDipswitch1)
x := touch_Get(TOUCH_GETX);
y := touch_Get(TOUCH_GETY);
DIPstate := (y - 100) / (60/2);
img_SetWord(hndl, iDipswitch1, IMAGE_INDEX, DIPstate);
img_Show(hndl, iDipswitch1);
//control BUS_0
if (DIPstate == 0)
pin_LO(BUS_0);
else
pin_HI(BUS_0);
endif
endif
endif
forever
Where I have to enter this code, or better said how can I enter it that it will works?
I have attached the program below:

What I have entered:


I added the var's because the program didn't compile.
But anyhow I have made it wrong because it didn't work.
Can anyone help me to bring the LED to shine =), would be nice.
Thank you, and best regards!
Dennis
At first I'm trying to descripe what I'm trying to do.
I have created a simple program in ViSi Genie with a DipSwitch, my goal was it to shine a LED.
So I have inserted a DipSwitch, how u can see in the picture below.
My next step was to migrate the ViSi Genie into a ViSi code.
Trough this step i got the code to make changes.
Because I'm not so familar with programing, I have tried to use your could which I have found in one of your PDF's.
bus_Set(0x00); //set all GPIO bus pins as outputs
bus_Out(0x00); //then set them to low
repeat
state := touch_Get(TOUCH_STATUS);
if(state == TOUCH_RELEASED)
n := img_Touched(hndl,iDipswitch1);
if(n == iDipswitch1)
x := touch_Get(TOUCH_GETX);
y := touch_Get(TOUCH_GETY);
DIPstate := (y - 100) / (60/2);
img_SetWord(hndl, iDipswitch1, IMAGE_INDEX, DIPstate);
img_Show(hndl, iDipswitch1);
//control BUS_0
if (DIPstate == 0)
pin_LO(BUS_0);
else
pin_HI(BUS_0);
endif
endif
endif
forever
Where I have to enter this code, or better said how can I enter it that it will works?
I have attached the program below:
What I have entered:
I added the var's because the program didn't compile.
But anyhow I have made it wrong because it didn't work.
Can anyone help me to bring the LED to shine =), would be nice.
Thank you, and best regards!
Dennis
Comment