Hi
I want to write a java program with J2ME or in Python for nokia 6680 in order to control the lamps of my house. I have done ready all the electronic schematics for controlling 220Volt lamps with arduino bluetooth and some code in java. I used the following code from "Massimo Banzini" to program arduino.
You can control the led from sending a 1 or 0 in ASCII from terminal to serial COM of arduino.
My problem is that i don't have time( also i don't have experience) to make the interface (GUI) with J2ME or with Python.
PS: If some one of you is interested in this project we could talk longer and begin doing something.
/* Bluetooth controlled Lamp
- ——————
- Massimo Banzi m.banzi (at) tinker.it
*/
int LED = 13; // select the pin for the LED
int RESET = 7;
int val = 0; // variable to store the data from the serial port
void setup() {
pinMode(LED,OUTPUT); // declare the LED's pin as output
pinMode(RESET,OUTPUT); // declare the RESET pin as output
Serial.begin(115200); // connect to the serial port
// Reset the bluetooth interface
digitalWrite(RESET, HIGH);
delay(10);
digitalWrite(RESET, LOW);
delay(2000);
//configure the bluetooth module
Serial.println("SET BT PAGEMODE 3 2000 1");
Serial.println("SET BT NAME BTLAMP");
Serial.println("SET BT ROLE 0 f 7d00");
Serial.println("SET CONTROL ECHO 0");
Serial.println("SET BT AUTH * 12345");
Serial.println("SET CONTROL ESCAPE - 00 1");
}
void loop () {
val = Serial.read();
// if the input is '-1? then there is no data
// otherwise read a digit between 0 and 9
// where 0 is off and 9 is full brightness
if (val != -1) {
val = val - 48; // transform the ASCII code into the numeric value
if(val == 1)
digitalWrite(LED, HIGH);
else if(val == 0)
digitalWrite(LED, LOW);
}
}