Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Problem on dividing, weird result on: May 30, 2009, 07:51:10 pm
and is there a way to fix this ?
2  Forum 2005-2010 (read only) / Syntax & Programs / Problem on dividing, weird result on: May 30, 2009, 07:44:11 pm
Code:
if (Serial.available() > 1) {
    delay(100);  //Mesaj gelsin
    lcd.clear();  //lcd temizle
    lcd.setCursor(0,0);  // cursor 0,

    for(i=0;i<2;i++) {
      lcdInput[i] = Serial.read();
    }
    if(lcdInput[0] == 'L') {
      lcd.print("Lightning ");      
      lightData = lcdInput[1];
      light = 255 / lightData;
      analogWrite(ledPin, light);
      lcd.print(light);

This is the code. And lets say, I sent L5 from serial.
this should divide 255 to 5 and the result should be 51.

But I always keep getting 4. If I convert the light type to float
they are 4.20 to 4.70

Btw:
float light;
int lightData;
int lcdInput[2]; // Buffer

any ideas ?
Thanks
3  Forum 2005-2010 (read only) / Interfacing / LCD Resets on Serial Data on: May 30, 2009, 09:06:07 am
Hello I am running the fallowing code on arduino:
Code:
#include <LiquidCrystal.h>

int ledPin = 13;
int startbyte;
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if (Serial.available()) {
    startbyte = Serial.read();
    lcd.write(startbyte);
    
}

}

And when I check LCD with serial monitor it works fine.
The problem is when I try to send data from a python script
to arduino it resets the lcd (like lcd.clear()) and then nothing happens

anyone have ideas ?
thanks
4  Forum 2005-2010 (read only) / Interfacing / Re: Python to Arduino Serial Connection data reading on: April 28, 2009, 09:56:10 am
That is exactly what I was looking for.
Thank you.
5  Forum 2005-2010 (read only) / Interfacing / Python to Arduino Serial Connection data reading on: April 27, 2009, 08:27:56 am
Hello I have a basic Python code that sents arduino over Serial Port
Code:
serialport = 'COM4'
ser = serial.Serial(serialport, 9600, timeout=1)

sCounter = 0
while sCounter <= 5:
    ser.write(contentElements[1])
    print sCounter
    time.sleep(0.5)
    sCounter = sCounter + 1
  
ser.close()

And the Arduino Code is
Code:
nt ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop(){
  if (Serial.available()) {
    int serData = Serial.read();
    Serial.println(serData);
    digitalWrite(ledPin, HIGH);
    delay(100);
    digitalWrite(ledPin,LOW);
    

  }

}
I just finished the python part and starting on the Arduino side, the data I am sending from Python is as fallows:

['2009.04.27', '12:55:14', '37.0408', '27.9242', 'CENTER']

An Array of some date time data, coordinates and some text

Now I can send the data succesfully but I can not check what am I receiving from the Arduino side because whenever I try to open the Serial Panel of Arduino Interaface it says "Serial Port is in Use" which is normal.

Is there a way that I can fallow the data I am receiving from Python to Arduino ?  I really need this.

Thanks for help.

6  Forum 2005-2010 (read only) / Interfacing / Re: analog in to 4 bit LCD driver on: May 01, 2009, 03:50:13 pm
None of those work. I will go insane.
Tried 2 different Libraries (lcd4Bit and Liquid Crystal, bot the original and the modfied one) with three 3 different LCD's, all 2x16 but different brands and all I can see is the boxes, not a single character.
7  Forum 2005-2010 (read only) / Interfacing / Re: analog in to 4 bit LCD driver on: April 28, 2009, 06:38:12 pm
This is the very basic Arduino code that I use with Liquid Crystal, Liquid Crystal seems less complex then lcd4bit and simple so I am just trying with it now:
Code:
#include <LiquidCrystal.h>

// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d4, d5, d6, d7 on pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop()
{
}

And the pin confugration is just same as there as fallows.
I am using it with a XIAMEN 1602K LCD (Amber-Black)

Unfortunately it is 03:42 here now and I am really sleepy, but tomorrow I will take a clear photo of the setup I have so you may have an idea about the general look. And also that will give me an another chance to re-check the cable stuff again.
thanks
8  Forum 2005-2010 (read only) / Interfacing / Re: analog in to 4 bit LCD driver on: April 28, 2009, 04:54:32 pm
Okay I got a 10K resistor today, connected it and after I adjusted I can see some stuff, not the actual text that is supposed to be there but I can see all the lower and upper 16 boxes light up. So the contrast is fine at the moment but both the LCD4Bit library or the one came with arduino IDE does not work, I double checked the connections and also tried with a new LCD but still the same.

Any ideas ? I will go insane soon.
9  Forum 2005-2010 (read only) / Interfacing / Re: analog in to 4 bit LCD driver on: April 27, 2009, 09:56:53 am
I just re checked the connections and the Backlight works fine now but now I have an another problem.

When I disconnect the Power lines for the lcd Display (not the ones for the Backlight) I see a pulse on the screen but nothings shows up,
it is like if I am going to write "Apple" on the screen, the boxes corresponding to those 5 letters light up for a very shortly like the letters going to appear but then nothing happens.

When I connect the power lines from Arduino to LCD that effect disappears and I just see the backlight.

I tried both 5V and 3V3 pins on arduino. But no luck.
Any ideas ?
10  Forum 2005-2010 (read only) / Interfacing / Re: analog in to 4 bit LCD driver on: April 27, 2009, 09:00:36 am
Hello I downloaded the LCD4Bit library,
I am using a 16x2 LCD (Amber on Black) from Sparkfun (GDM1602K)

The Pins and connections as fallows:

LCD  ->  Arduino

4 (RS) to Arduino Pin 12
5 (RW) to Arduino Pin GND
6 (E) to Arduino Pin 2

DB4 to Arduino Pin7
DB5 to Arduino Pin8
DB6 to Arduino Pin9
DB7 to Arduino Pin10

VSS GND to Arduino GND
VDD +5V to Arduino Pin 5V

I also connect the Pins on LCD 15(4.2V Led) and 16 (Power Supply for BKL 0v) to Arduino 5V and GND pins.

And I load up the example sketch from the library, upload it to Arduino and run it, the Test Led on 13 keeps blinking means data is going but there is no sign of any light/character on my LCD.

Any suggestions ?
Thanks
11  Forum 2005-2010 (read only) / Interfacing / Controlling aquarium air pump on: May 21, 2009, 04:56:57 am
Hello I am trying to control an aquarium air pump with arduino.
Actually I am not trying but I want to. It is a basic air pump works with
wall electricty. Is there any way to control those kind of devices
with an Arduino ?
Basically I'd like to adjust the air level, tank temperature etc. from my computer instead of using my hand.

Thanks smiley
12  Forum 2005-2010 (read only) / Interfacing / PS2 Keyboard with Arduino on: April 19, 2009, 09:35:15 am
Hello I am working on a project and I need to count the keystrokes of a PS2 keyboard, I saw some article at sparkfun website and also a device built for that purpose but I need to do this with an Arduino Board as I am going to add some more stuff to respond those keystrokes.

Anyone have an tutorial / source that can share ? Or point me to a good place to start ?
Much appreciated.
13  Forum 2005-2010 (read only) / Interfacing / Re: Servo Motor Help on: February 28, 2009, 02:03:22 pm
Basicly I know what does type of stuff do, I want to learn which type fits best with my situation and controllable with an Arduino.
14  Forum 2005-2010 (read only) / Interfacing / Servo Motor Help on: February 28, 2009, 05:14:57 am
Hello, for a school project (a device like a guitar that has strings on it, and from a data read from internet some motors pulling the strings to play sounds) I am looking for some servo or stepper motors to use with Arduino. I did not decided yet to what kind of motor to use but I am really looking for some help.

Anyone have some experiences with those motors please can point me to a webpage/article/etc.. about Arduino and motors ?

Or any article about how to control 6 to 8 Servos with arduino ?
I read on forum that only 2 Servos can be controlled with the Servo library. So do I need to get 4 Arduinos to control 8 Servos ?


And for a project like that which will go best ?
I have (by luck) some Dynamixel AX-12's in hand but they can not be used with Arduino as far as I see on the forums.

If you could guys help, very appreciated.
thanks.

15  Forum 2005-2010 (read only) / Interfacing / Led Sensing on: November 22, 2008, 04:13:50 pm
Hello folks,

I have been trying to use LED Sensing for a while and I have managed to make it work with just one Led, I can receive input and draw some output with processing, the problem is when I connect two or more leds, lets say three, the results are become weird.

Anyone have some experience with Led Sensing ? Or a tutorial or some ideas that u can share ?

Pages: [1] 2