Pages: [1]   Go Down
Author Topic: AS3Glue: Send commands to OneWire Thermometer  (Read 2612 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!!

I am trying to get the Dallas Semiconductor DS18B20 Digital Thermometer (http://www.arduino.cc/playground/Learning/OneWire) to communicate with Flash AS3 via the AS3Glue protocol and Firmata 2.0.

For those of you who may be a bit fuzzy about this, here's a quick breakdown.
OneWire is attached to an Arduino Digital Pin
Firmata 2.0 is on the Arduino
The Firmata sends data to Flash via the SerProxy application
Flash communicates with Firmata via the AS3Glue library
[/list]

Sooo... In Flash, I am trying to send "ds.write(0xBE);" to the OneWire using something like the arduino.writeDigitalPin () function. :-?

The working arduino code has this main bit: (The full code is attached.)

Code:
ds.reset();
  ds.select(8);
  ds.write(0x44,1);         // Start Converting Temp Data

  delay(600);
 
  present = ds.reset();
  ds.select(8);  
  ds.write(0xBE);         // Read Temp Data

  for ( i = 0; i < 9; i++) {           // we need 9 bytes
      data[i] = ds.read();
  }


In flash, I have this (doesn't work...yet):
Code:
var timer6:Timer = new Timer(600,1);
timer6.start();
var resetT:String = "ds.reset()";
var startConversion:String = "ds.write(0x44,1)";
var getConversion:String = "ds.write(0xBE)";

function setUpTherm (e:Object):void {
  
    arduino.writeDigitalPin(8,resetT);
    arduino.writeDigitalPin(8,startConversion);
    timer6.addEventListener("timer", getTemp);
}

  
function getTemp(e:TimerEvent) {
    arduino.writeDigitalPin(8,resetT);
    arduino.writeDigitalPin(8,("getConversion"));
  
    for ( i = 0; i < 9; i++) {           // we need 9 bytes
        data[i] = arduino.writeDigitalPin(8,("ds.read()"));
    temperature.text = CTemp.toString();                                                  
  }
}

This taps into a bigger question of how to send info to the digital pins from Flash using more than just HIGH or LOW commands.

Please throw in your 2 cents!! Thanks so much!!

HERE ARE THE FILES:  http://rapidshare.com/files/188937417/OneWire.zip.html
Logged

Pages: [1]   Go Up
Jump to: