Flash Teleo Notes
syllabus | schedule | assignments | class notes | web resources | ARTC courses
Working with the Teleo Board in Flash
Getting Started
  1. Make sure the Teleo board USB and power cords are plugged in and receiving power before starting the XML server.

  2. Start the server by double clicking on: TeleoXMLServerMacOSX (located in the Japanese Girl icon on the Dock)
    • If it starts correctly it should look like this:

    XML Server results

  3. Minimize the terminal window - click the YELLOW circle (do not quit terminal).
    • The XML server needs to be running while you are using the Teleo board.

  4. Launch FLASH.
    • Do NOT test/run your flash file before the Teleo board is ON and plugged in or the server is started because it will crash your computer trying to find the Teleo.
Making a Flash/Teleo Project
  1. Make sure the COM folder is in the same folder as your Flash file

  2. You need to import the Teleo library:
    • In Flash on an Actions layer type:

    •        import com.makingthings.*;

Using Digital In

Digital In is used for push buttons and any sensor that you only need to know if it is ON or OFF. You use the same wiring setup for all types of sensors that are being used for their ON/OFF state only (Pressure sensor, Light sensor, etc).
  1. You need to STOP the Flash program from running
  2. Attach the wires as shown in the diagram below:
Digital In

Code to use Digital In to change the size of a movieclip named bigred

import com.makingthings.*;

// Create a new variable called din. This variable is of the type TIntroDin which is defined in the Teleo library
// Note that the 0 means you must have the wire attached to DIn 0 to work - change this to 1, 2, 3 if you attach it elsewhere.

var din:TIntroDin = new TIntroDin(0);

// Tell the program how often to go out looking for a change in values

din.setPeriod(10);

// Create a function that is triggered when a button or sensor has been triggered
// Note that the value (0 or 1) is passed into the function

din.onValue = function(value:Number) {

// Now we create an if block to scale the bigred movieclip

      if (value == 1) {
           bigred._height = 100;
           bigred._width = 100;
      } else {
           bigred._height = 50;
           bigred._width = 50;
      }
};


Using Digital Out

Digital Out is used to turn on a LED or small light
  1. You need to STOP the Flash program from running
  2. Attach the wires as shown in the diagram below:
Digital Out

Code to use Digital Out to turn on a LED

import com.makingthings.*;

// Create a new variable called dout. This variable is of the type TIntroDout which is defined in the Teleo library
// Note that the 0 means you must have the wire attached to Dout 0 to work - change this to 1, 2, 3 if you attach it elsewhere.

var dout:TIntroDout = new TIntroDout(0);

// Create two functions for a movieclip called digitaloutButton - one for onPress and one for onRelease

digitaloutButton.onPress = function() {
      _root.dout.setValue(1); // This code turns the LED on - note we are setting the dout variable to 1 to turn it on. 0 turns it off.
};

digitaloutButton.onRelease = function() {
      _root.dout.setValue(0);
};


Using Analog to Digital

Analog to Digital allows you to get values from 0 to 255. This is used with a pressure sensor, Photo resistor (light sensor), Potentiometer (POT), etc.
  1. You need to STOP the Flash program from running
  2. Attach the wires as shown in one of the diagrams below:
Photo Resistor (Photocell) or Light sensor

Analog to Digital Light Sensor

Potentiometer (POT)

Analog to Digital Potentiometer

Pressure Sensor

Analog to Digital Pressure Sensor

Code to use Analog to Digital

First I made a movieclip called tPiece. Then I made a dynamic textbox called readout.

import com.makingthings.*;

// Create a new variable called ain. This variable is of the type TIntroAin which is defined in the Teleo library
// Note that the 0 means you must have the wire attached to Ain 0 to work - change this to 1, 2, 3 if you attach it elsewhere.

var ain:TIntroAin = new TIntroAin(0);

// Setting the resolution adjusts the sensitivity

ain.setResolution(6);
tPiece.onEnterFrame = function() {
      var v:Number = ain.getValue();
      readout.text = v;
      tPiece._rotation += v;
};

Pulse Width Modulation

Pulse Width Modulation allows you to run a motor at different speeds. This actually turns off and on the electricity at a certain rate. It can also be used to dim lights.
  1. You need to STOP the Flash program from running
  2. Attach the wires as shown in the diagram below:
Pulse Width Modulation

Pulse Width Modulation

Code to use Pulse Width Modulation

I made three movieclips called slow, medium and fast. I am using the trace to see when it gets into the function.

import com.makingthings.*;

// Create a new variable called pmw. This variable is of the type TIntroPwm which is defined in the Teleo library
// Note that the 0 means you must have the wire attached to PWM 0 to work - change this to 1, 2, 3 if you attach it elsewhere.
// setDuty changes the rate of electrical on/off switches.

var pwm:TIntroPwm = new TIntroPwm(0);

slow.onRelease = function() {
      pwm.setDuty(0);
      trace("slow");
};

medium.onRelease = function() {
      pwm.setDuty(200);
      trace("medium");
};

fast.onRelease = function() {
      pwm.setDuty(400);
      trace("fast");
};


IMPORTANT NOTES:
  1. Never connect the V+ connector to the 5V connector - this would put the whole power supply at V+ onto the board's electronics which are designed to run at 5V. This may still destroy components on the board.

  2. Never connect the V+ or the 5V supplies directly to the ground (GND) this would cause a short circuit either of the whole power supply or the board's local power supply.

  3. Digital Out - Never connect LEDs to V+. You will notice that there are both 5V and V+ connectors available for connecting to the Digital Out connectors. You can use either, but not both on the same connector since that would result in a direct connection between the V+ supply and the 5V supply. The V+ will supply up to a total of 6 amps to all output circuits on the board. The 5V supply is very limited. Do not try to run motors, and other mechanical devices off this supply since it will almost certainly cause the 5V voltage regulator to overheat and or the processor to reboot. The 5V supply is provided to control LED's and other very frugal users of current.

  4. Pulse Width Modulation - Never connect the V+ connection directly to the PWM output since as soon as the switch turns on, the current will surge from the power supply, through the switch, possibly destroying it. Connect it to the V+.

  5. Quit the XML Server terminal when done - Quit then Yes to Terminate