With the turn of the knob widget I would like to send the knob value using serial COM1 to my microcontroller. So far I tried:
func movef1knob()
var degrees;
// knob1 generated 11/11/2011 2:51:42 PM
degrees := XYposToDegree(x-322, // x - CentreX
y-50) ; // y - centreY
if (degrees < 45) // anything in the first 'dead zone' is minvalue
degrees := 0 ;
else
if (degrees > 315) // anything in the last 'dead zone' is maxvalue
degrees := 270 ;
else
degrees -= 45 ; // offset by -baseangle
endif
endif
posit1 := degrees * 100 / 270 ; // convert degrees to position
img_SetWord(hndl, iKnob1, IMAGE_INDEX, posit1);
img_Show(hndl, iKnob1);
txt_MoveCursor(9,38);
print([DEC3ZB] posit1) ;
to(COM1); putstr(posit1);
endfunc
putstr(posit1); does not seem to send the value to my microcontroller. To test if my microcontroller is properly setup to receive serial data I placed serout1('a'); in the repeat forever section of the code. My microcontroller outputs "Data Received" and repeats. I removed the serout1('a') once I knew my microcontroller was able to receive data.
func movef1knob()
var degrees;
// knob1 generated 11/11/2011 2:51:42 PM
degrees := XYposToDegree(x-322, // x - CentreX
y-50) ; // y - centreY
if (degrees < 45) // anything in the first 'dead zone' is minvalue
degrees := 0 ;
else
if (degrees > 315) // anything in the last 'dead zone' is maxvalue
degrees := 270 ;
else
degrees -= 45 ; // offset by -baseangle
endif
endif
posit1 := degrees * 100 / 270 ; // convert degrees to position
img_SetWord(hndl, iKnob1, IMAGE_INDEX, posit1);
img_Show(hndl, iKnob1);
txt_MoveCursor(9,38);
print([DEC3ZB] posit1) ;
to(COM1); putstr(posit1);
endfunc
putstr(posit1); does not seem to send the value to my microcontroller. To test if my microcontroller is properly setup to receive serial data I placed serout1('a'); in the repeat forever section of the code. My microcontroller outputs "Data Received" and repeats. I removed the serout1('a') once I knew my microcontroller was able to receive data.
Comment