Show Posts
Pages: [1] 2 3 ... 7
1  Using Arduino / Programming Questions / Re: Problem while adding numbers on: May 24, 2014, 06:10:57 am
That wat, thanks.

I changed int to long int and now it works. So I should use the biggest possible if I pretend to use big numbers
2  Using Arduino / Programming Questions / Problem while adding numbers on: May 24, 2014, 05:09:55 am
I don't know what is happening. I paste all my code to see if you can see what I am doing wrong.

I am trying to make a program to make time lapse with my nikon camera. And I added a lcdkeypad to my arduino uno to select time between photos.

Maybe I have some mistaked related to that part, I haven't tested yet due to my problem but I don't mind that for the moment.

The problem is that if I add +1 or substract -1 to the seconds value (+1000 or -1000) it works fine. but if I try +5000 or -5000, when it reach 30 secs or -30 secs, it changes the sign. If the number was +30, the next value will be -25 and so on...

Code:
// include the library code:
#include <LiquidCrystal.h>

int seconds;
long int select;
long int millisCount;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


void setup() {
  // set up the LCD's number of columns and rows:
  Serial.begin(9600);
  pinMode(6, OUTPUT);
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.setCursor(0,0);
  lcd.print("TimeLapse");
  lcd.setCursor(0,1);
  //lcd.print("Time in secs:");
  seconds = 1;
  select = 0;
  millisCount = 0;
  lcd.print (seconds, DEC);
}

void loop() {
  int x;
  x = analogRead (0);
  if(select == 1){
  lcd.setCursor(0,1);
  if (x < 60) { //Right
lcd.print ("          ");
lcd.setCursor(0,1);
seconds = seconds + 1000;
lcd.print (seconds/1000);

  }
  else if (x < 200) { //UP
lcd.print ("          ");
lcd.setCursor(0,1);
seconds = seconds + 5000;
lcd.print (seconds/1000);
                Serial.println(sec);  
  }
  else if (x < 400){ //Down
lcd.print ("          ");
lcd.setCursor(0,1);
seconds = seconds - 5000;
lcd.print (seconds/1000);
                Serial.println(seconds/1000);
  }
  else if (x < 600){ //Left
lcd.print ("          ");
lcd.setCursor(0,1); 
seconds = seconds - 1000;
lcd.print (seconds/1000);

  }
          if(millis() - millisCount > seconds){
            millisCount = millis();
            digitalWrite(6, HIGH);
            delay(200);
            digitalWrite(6, LOW);
          }
}
  if (x < 800 && x > 600 && select != 1){
    lcd.setCursor(10,1); 
    lcd.print ("Select");
    select = 1;
  }else if(x < 800 && x > 600&& select == 1){
    lcd.setCursor(10,1); 
    lcd.print ("      ");
    select = 0;
  }
  delay(250);
}
3  Using Arduino / Sensors / Library for dht22 on: January 06, 2014, 12:17:34 pm
I am trying to run a sketch with a dht22 sensor and always I get a NaN value as read. I am using ada fruit library downloaded from here: https://github.com/adafruit/DHT-sensor-library

I opened the .cpp file to see what it does and I found these lines:

Code:
switch (_type) {
    case DHT11:
      f = data[0];
      return f;
    case DHT22:
    case DHT21:
      f = data[0];
      f *= 256;
      f += data[1];
      f /= 10;
      return f;
    }
Serial.print("Read fail");
  return NAN;

And something similar for temperature.  It always prints "Read fail". But I don't know if it is because the library or not. I am using the correct pin and my sketch just is the example they provide. So I think it should work. Do you know another library for testing?
4  Using Arduino / Sensors / Re: UV AB measurement on: May 27, 2013, 05:32:28 am
Sorry for my late answer. I couldn't check it yet. I need the sensor for turtles also, so if you find one, I will be interested in it.
5  Using Arduino / Microcontrollers / Update arduino fio bootloader to support Watchdog on: May 26, 2013, 09:03:01 am
I want that my arduino fio supports watchdog to be able to use it on my project.

I tried examples given by Nick Gammon in this post: http://forum.arduino.cc/index.php?PHPSESSID=p1m7quagmbvqqj3pd0sfl0rul2&topic=128717.0

But it starts to get reset constantly and I have to power off and on again to be able to reprogramming it.

I haven't found a bootloader for arduino fio in arduino's webpage.
6  Development / Other Software Development / Re: How to keep compiled files in arduino ide on: May 17, 2013, 09:19:26 am
I also discovered that if I close IDE, when I open again, load the sketch and try to compile, it compiles everything from source because it deletes everything... I can't compile from compiled files changing just my pde...

Anything about this?
7  Development / Other Software Development / Re: How to keep compiled files in arduino ide on: May 17, 2013, 03:02:01 am
Thanks Pito it works.

Do you know how to set relative paths? I would want to make it portable and be able to set the Arduino folder in any place. What do I have to do to define a path inside Arduino folder?

Something like /arduino/compiledLibraries ...
8  Development / Other Software Development / How to keep compiled files in arduino ide on: May 16, 2013, 06:17:49 am
I know that Arduino ide does it. Version you can downloaded compiled from webpage does it. But I downloaded source code to modify a couple of lines and my version doesn't do it.

Where do I have to save that files? or... where do I have to modify source code to get it?
9  Development / Other Software Development / Re: Modify IDE just for compiling on: May 14, 2013, 10:26:27 am
Well... I have discovered that with new arduino ide I can compile just one time, and if I don't change libraries, I can delete them... It keeps compiled version. Where does it get saved? Can I cut the arduino folder and take it away?

Which java file has the buttons? I am interested in delete some of them...
10  Development / Other Software Development / Modify IDE just for compiling on: May 14, 2013, 03:19:09 am
I am using other arduino based board (waspmote) but I guess this is not important for my target right now.

I want to modify arduino ide to make it able just for compiling a program. I mean, I want to delete upload button and some others too (like serial port, etc)

Also, I want to compile just pde. I have some libraries developed (also downloaded from internet or libraries from arduino) and I don't want to be able to modify them.

With this, I mean I want to have them already compiled, it is no need to recompile anytime and I don't want that anybody see the code. So I would just to write my sketch in arduino ide and be able to compile it to see if there are any compiling mistake, anything else.

I found there is a file called Compiling.java in Source code but I don't know which part I should delete to be able to have my files compiled or where to specify the directory of my libraries...
11  Using Arduino / Sensors / Re: UV AB measurement on: May 08, 2013, 09:23:45 am
Yeah, I already do that. But I don't know if they meassure UVA or UVB since I don't know anything about their difference... I was looking for a sensor which just meassure A or B if it exists
12  Using Arduino / Sensors / UV AB measurement on: May 08, 2013, 03:56:01 am
I am trying to get the value of my sun lights (For reptils). I read I have to change them each 6 months because A or B rays get wasted and lose properties (or something like that).

Which sensors do you know for doing that? (cheap, better).
13  Development / Other Software Development / Re: Updated DS1307 simple library for arduino 1.0 and older on: May 08, 2013, 03:53:18 am
Maybe your RTC is "broken".

I have a couple of tiny RTC bought on ebay and one of them works fine and the other one, when I poweroff external battery, loses the hour. So, external battery doesn't work. I tried with the other one's battery and same happends.

But the other one, works fine with and without external power.
14  Using Arduino / Interfacing w/ Software on the Computer / Re: Python + Arduino on: April 30, 2013, 03:53:07 am
In python just have to do this:
1 - Import library:
Code:
import serial

2 - Open port:
Code:
ser = serial.Serial('/dev/ttyUSB0', 38400, timeout=1)

Setting the correct port and baudrate.

3 - Read data:
Code:
read = ser.read(X)

Where X is the number of bytes you want to read together. If you just write read = ser.read(), you read 1 byte.

I recommend you to read just one byte at a time because if you read more than one, it will kept as string and you cannot modify it. For avoiding it and be able to modify you have to save it as list but I haven't the code here right now.

And, the rest is treat that data in functions or whatever you want.
15  Using Arduino / Programming Questions / Re: Can the Arduino Uno rev 3 handle 2 sensors? on: April 30, 2013, 02:21:26 am
PIns are connectors on arduino or sensor. Each wire has a pin in the end and it has to be connected to an arduino pin (normally, not all of them sometimes)
Pages: [1] 2 3 ... 7