ledtOff d = {main = ledOff (lit d) :. noOp}
readDPin :: DigitalPin -> Main (ByteCode () Stmt)
-readDPin d = sds \pin=False In {main=pin =. digitalRead d :. noOp}
+readDPin d = sds \pin=False In {main=pin =. digitalRead d :. pub pin :. noOp}
ledSelection :: Task UserLED
ledSelection = enterInformation "Select LED" []
LINE_ARD_D4, LINE_ARD_D5, LINE_ARD_D6, LINE_ARD_D7, LINE_ARD_D8,
LINE_ARD_D9, LINE_ARD_D10, LINE_ARD_D11, LINE_ARD_D12, LINE_ARD_D13,
LINE_ARD_D14, LINE_ARD_D15};
+
void write_dpin(uint8_t i, bool b)
{
palWriteLine(dpins[i], b ? PAL_HIGH : PAL_LOW);
bool read_dpin(uint8_t i)
{
+ debug("readpin: %d", i);
return palReadLine(dpins[i]) == PAL_HIGH;
}
write_byte('p');
write16(sdss[cs].id);
write_byte(sdss[cs].type);
- write16(sdss[cs].value);
+
+ switch(sdss[cs].type){
+ //Long
+ case 'l':
+ //Int
+ case 'i':
+ write16(sdss[cs].value);
+ break;
+ case 'b': //Bool
+ case 'c': //Character
+ case 'B': //Button
+ case 'L': //UserLED
+ write_byte(sdss[cs].value);
+ break;
+ }
write_byte('\n');
return;
}