Hello! fellow Arduino users,
(I "stumbled" into this and thought it was way-cool!)
To control the brightness of a LED on Arduino Pin 9 to ground (I have an Uno, and don't forget the series resistor!), from FlowStone (1.1.3).
(Note: I am using Windows 7 64bit Home Premium and the Arduino-0022 version sketch editor.)
Use this demo sketch:
/*
Dimmer
NOTE: Accepts Hex Value from FlowStone "Com_Port_Tester.fsm"!!!
Demonstrates the sending data from the computer to the Arduino board,
in this case to control the brightness of an LED. The data is sent
in individual bytes, each of which ranges from 0 to 255. Arduino
reads these bytes and uses them to set the brightness of the LED.
The circuit:
LED attached from digital pin 9 to ground.
Serial connection to Processing, Max/MSP, or another serial application
created 2006
by David A. Mellis
modified 14 Apr 2009
by Tom Igoe and Scott Fitzgerald
This example code is in the public domain.
*/
const int ledPin = 9; // the pin that the LED is attached to
void setup()
{
// initialize the serial communication:
Serial.begin(9600);
// initialize the ledPin as an output:
pinMode(ledPin, OUTPUT);
}
void loop() {
byte brightness;
// check if data has been sent from the computer:
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255):
brightness = Serial.read();
// set the brightness of the LED:
analogWrite(ledPin, brightness);
}
}
Then I went to the FlowStone website and found a program called "Com_Port_Tester.fsm".
Run this in FlowStone diagram with the com port set (mine is on COM3) and insure you have "Hex" set to "True".
Enable the top "Switch" to turn the com port on (green light on FlowStone SHOULD light).
In the input box (labeled "s" on both sides) enter a hex number from 00 to FF (FF is 255)
The LED on pin 9 on the Arduino SHOULD change brightness!
Next steps hopefully will allow FlowStone to read back the analog ports, control bit input/output, PWM, and servos!
(This will allow COMPLETE FlowStone control of the Arduino with no special software in FlowStone OR on the Arduino.)
***** I NEED LOTS OF HELP HERE so please take this example and run with it!!!!
(FlowStone is an AWESOME way to control an Arduino!!!)
Respectfully,
WillBuilder