Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Port Not Reading Correctly on: December 30, 2013, 09:44:54 pm
I don't know why I had that.  Thanks.  So that solved my main problem of the Arduino not talking to Processing (silly me).  Now this is probably a really stupid question, but how do I get the serial input to read integers (i.e. values from 0 - 255)?
2  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Port Not Reading Correctly on: December 30, 2013, 09:03:27 pm
I added debugging lines to the code I was actually using while communicating with Processing, and got different results.  Now the serial input never equals 1 and byte input always equals 255

Code:
if (Serial.read() > 0) {
    byte input = Serial.read();
    if (input == '1') {
      Serial.println("1");
      digitalWrite(13, HIGH);
    } else {
      Serial.println("not 1");
      digitalWrite(13, LOW);
    }
    Serial.println(input);
  }
Serial Monitor:
Code:
not 1
255
not 1
255
not 1
255
not 1
255
3  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Port Not Reading Correctly on: December 30, 2013, 08:45:23 pm
Even doing that, I still get 49 back by pressing 1.  This is what the code says now:
Code:
if (Serial.available()) {
    byte input = Serial.read();
    // debug serial input
    Serial.println(input);
4  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial Port Not Reading Correctly on: December 30, 2013, 08:34:54 pm
OK, I see what you mean.  But why would it output numbers in the 50s when I send numbers less than 10?
5  Using Arduino / Interfacing w/ Software on the Computer / Serial Port Not Reading Correctly on: December 30, 2013, 08:17:40 pm
I am trying to get my Arduino Uno to communicate with Processing in order to use my Kinect Sensor, and ran in to trouble passing data from the Processing to the Uno.  I tried running a basic sketch to change the brightness of an LED based on the serial input, and got some unusual results.  No matter what I type into the Serial Monitor, Serial.read() returns -1.  Please help!

Code:
void setup(){
  pinMode(11, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    int input = Serial.read();
    // debug serial input
    Serial.println(Serial.read());
    Serial.println(input);
    // write to LED on PWM 11
    analogWrite(11, input);
  }
}

Sample Serial Monitor:
keys pressed: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
Quote
-1
49
-1
50
-1
51
-1
52
-1
53
-1
54
-1
55
-1
56
-1
57
-1
48
6  Using Arduino / Project Guidance / Re: Simple easy programmable muliti day alarm clock. on: October 08, 2012, 08:41:04 pm
Eric,

10 minutes a day is a bit too much. Are you keeping the shield in doors with constant temperature? The time can only be accurate with DS1307 if the crystal is kept at constant in door temperature. The crystal oscillation frequency is a function of temperature.

Yes, it is indoors all day.  I have a desk in my (finished) basement so room temperature is in the mid 60s.  I have the alarm clock uploaded and now I can set the time from the shield, meaning I can see exactly how quickly it is losing time.  I counted that for every one second the program "ticks", two real time seconds pass.  This means that after 5 minutes, the clock will be 10 minutes behind.

If I find a permanent location for this shield, and figure out how much time i is losing, can the code be easily modified to compensate for this?

Thanks,
Eric
7  Using Arduino / Project Guidance / Re: Simple easy programmable muliti day alarm clock. on: October 07, 2012, 06:21:40 pm
Keep an eye with the setup see if it loses time too quickly like a few minutes or more per day. I would appreciate a picture of the underside of the board. Oh, you can buy some solder wick to help with desoldering pins. Drove me nuts trying to unsolder a row of pins before I knew solder wick or desoldering iron.

I am running the Phi_2_testing_v3 and am losing time rather quickly.  First off, my computer takes 5+ minutes to compile the code, even after i hacked the IDE to skip previously compiled files.  Secondly, the time was 5 minutes behind when I uploaded it, and when I checked back half an hour later, it was 10 minutes behind.  I don't understand.

Also, I can compile or upload the alarm clock version 5.  The IDE returns about 200 lines of errors and lots of warnings.

Any help is appreciated.

Eric_R
8  Community / Products and Services / Re: 30 Arduino Projects for the Evil Genius on: August 23, 2012, 05:48:07 pm
Hey, I am trying to make the Multicolored Light display from project 14 work and am running into some trouble.  My main issue is that the led that I am using (datasheet at http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Components/General/YSL-R1047CR4G3BW-F8.pdf) does not display all of the 48 colors specified in the script. It will only show 6 different colors (light blue, blue, pink, red, yellow, green). Also, the colors only loop in one direction (i.e. it will always go from blue to pink to red, etc. and never from red to pink to blue).  I am not very experienced and I want to know how to get the program to differentiate between a clockwise turn and a counterclockwise turn of the rotary encoder.

Thanks,
Eric_R

P.S. Simon, what program did you use to create the diagrams in the book.  Fritzing is ok, but not very user-friendly.
Pages: [1]