LIvecode 4.5.2 and 4.5.3(rc4)
Arduino Uno 0022

Sarah's SerialTest stack modified with the MakeBoard code for finding the port 
name since the SerialTest stack does not find the port. 


Arduino Code which works from Serial Monitor within Arduino IDE but not from 
LiveCode:

/*Simple Serial  
   Language: Arduino/Wiring
   
   Listens for an incoming serial byte, adds one to the byte 
   and sends the result back out serially.  Also blinks an LED 
   on pin 13 every half second.
*/
int LEDPin = 13;             // you can use any digital I/O pin you want
int inByte = 0;              // variable to hold incoming serial data
long blinkTimer = 0;         // keeps track of how long since the LED 
                             // was last turned off
int blinkInterval = 1000;    // a full second from on to off to on again

void setup() {
  pinMode(LEDPin, OUTPUT);    // set pin 13 to be an output
  Serial.begin(9600);         // configure the serial port for 9600 bps 
                              // data rate.
}

void loop() {
  // if there are any incoming serial bytes available to read:
  if (Serial.available() > 0) {
    // then read the first available byte:
    inByte = Serial.read();
    // and add one to it, then send the result out:
    Serial.print(inByte+1, BYTE);
  }
  
  // Meanwhile, keep blinking the LED.
  // after a quarter of a second, turn the LED on:
  if (millis() - blinkTimer >= blinkInterval / 2) {
    digitalWrite(LEDPin, HIGH);      // turn the LED on pin 13 on 
  }
  // after a half a second, turn the LED off and reset the timer:
  if (millis() - blinkTimer >= blinkInterval) {
    digitalWrite(LEDPin, LOW);        // turn the LED off
    blinkTimer = millis();            // reset the timer
  }
}

-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgr...@comcast.net

On Jan 21, 2011, at 7:36 PM, Claudi Cornaz wrote:

> 
> Tom,
> 
> Which version combination are you using?
> 
> Best wishes,
> Claudi
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to