Show Posts
Pages: 1 ... 90 91 [92] 93 94 ... 285
1366  Using Arduino / Programming Questions / Re: ENCODER HOW TO ENCREASE THE PRECISION ,? on: February 07, 2014, 02:00:11 pm
Code:
void encoder(const int piste_A, const int piste_B)
{

  attachInterrupt(0,direction_speed, RISING);
}
What is this function supposed to be doing ?  It is supplied 2 parameters that are never used in the function and attaches an interrupt each time through the loop() function when it only needs to be attached once in setup()

Then, later on, in the middle of the ISR you attach the same interrupt to another routine 20 times
Code:
  while(i<20)
  {
    attachInterrupt(0,increment,RISING);

    i=i+1;
  }
What's that all about ?

Later in the same ISR you attempt to print a variable that is not defined even though Serial.print() does not work in an ISR because interrupts are disabled.
Code:
  Serial.println(vitesse);
1367  Using Arduino / Programming Questions / Re: Communication between arduinos with sensors on: February 07, 2014, 01:18:25 pm
How are the 2 Arduinos connected at the moment ?

You don't need to pack the data on the sending Arduino beyond adding a "start of message" indicator, a dividing character between each value and an "end of message" indicator at the end of the message.  Most of the work then takes place on the receiving Arduino.  This will be a good place to start in order to build a string on the receiving Arduino that you can then take apart using the strtok() function using the dividing characters that you added before transmission.  http://gammon.com.au/serial

Is it a good idea to use the same serial interface for receiving data and writing to the serial output ?
1368  Using Arduino / Programming Questions / Re: Arduino Uno Project - Counter does not begin from 0 on: February 07, 2014, 01:06:27 pm
If you cannot track down the problem and understand it then it may come back to bite you at some time.  Did you try what I suggested in reply #9 ?
1369  Using Arduino / Programming Questions / Re: Communication between arduinos with sensors on: February 07, 2014, 12:32:43 pm
Start by using SoftwareSerial on both Arduinos assuming that the boards do not have 2 or more hardware serial ports.  That will enable you to use the hardware serials on the Arduinos to debug your code.  Connect the 2 Arduinos together using the pins defined in their SoftwareSerial setups.

Now, forget your eventual aim.  Can you send a single, hard code byte from Arduino A to Arduino B, read it and display it ?  When you can do that you are ready to move on.
1370  Using Arduino / Programming Questions / Re: Compile two sketches on: February 07, 2014, 12:26:59 pm
Quote
I'm using Cytron's LCD Keypad Shield, so...?
That uses pin 9 for the LCD too so you cannot use that for the servo, but you do need it connected to make the LCD work I would think.

From the Cytron documentation
Quote
3. PIN ALLOCATION
Pin Function
Analog 0 Button (select, up, right, down and left)
Digital 4 DB4
Digital 5 DB5
Digital 6 DB6
Digital 7 DB7
Digital 8 RS (Data or Signal Display Selection)
Digital 9 Enable
Digital 10 Backlight Control
1371  Using Arduino / Programming Questions / Re: Arduino Uno Project - Counter does not begin from 0 on: February 07, 2014, 12:16:23 pm
Quote
I solved the problem by using the variable R and R2 in my code, and now it starts counting from 0
You didn't solve it, you worked around it by adding a fudge factor.
1372  Using Arduino / Programming Questions / Re: Arduino Uno Project - Counter does not begin from 0 on: February 07, 2014, 11:10:32 am
When you see the number 1 on the LCD is it coming from the lcd.print() in setup() or the lcd.print() in loop() ?
Temporarily put a delay(2000); at the end of setup().  What do you see during that delay ?
1373  Using Arduino / Programming Questions / Re: Compile two sketches on: February 07, 2014, 09:46:26 am
Okay guys i tried to rejoin the pins but this time i just plugged the LCD Keypad Shield straight to the board. It works perfectly after i upload a LCD sketch. But when i rejoin them back to the breadboard, it just showing the white boxes. Any idea?
As has been suggested it would seem that you have an error in your wiring.  Until you get the LCD working with the Arduino it is not worth adding the servo or the code to drive it.  By using a breadboard instead of plugging the LCD shield into the Arduino you are increasing the chances of not wiring it correctly or missing a connection.  Looking at the photo of your setup I am not surprised that there might be a wiring error in all of that spaghetti.

Can you provide a link to the LCD/button shield that you are using ?  If it is this one http://www.dfrobot.com/index.php?route=product/product&product_id=51#.UvTyU2J_s1I then the page says that
Quote
Pins 4, 5, 6, 7, 8, 9 and 10 are used to interface with the LCD.
so you cannot use pin 9 for the servo anyway.
1374  Using Arduino / Programming Questions / Re: Code for Arduino Due to get LED to change brightness isn't working on: February 07, 2014, 03:55:01 am
What happens if you set the initial value of on to 1 ?  Do you get any output ?  If so, then the problem is with the interrupt or how it is triggered.   You have chosen an odd way to set the on variable to either 0 or 1.  Why not make it a boolean and then use
Code:
on = !on;
to flip the value ?  Why the test for on == 0 when you do nothing whatever the result ?
1375  Using Arduino / Programming Questions / Re: Arduino Robot with Ping))) Sensor on: February 07, 2014, 03:08:18 am
I am not familiar with the Arduino robot but from the code you posted it appears that the robot will turn right in steps of approximately 90 degrees until the distance in front of the sensor is less than 40cm.  Do you know what value is being returned for cm whilst the robot is turning and testing distances ?  Use Serial.print or send a value to the screen to find out.
1376  Using Arduino / Programming Questions / Re: PORT outputs going LOW unexpectedly on: February 07, 2014, 02:04:34 am
What devices are you driving from the pins ?
1377  Using Arduino / Programming Questions / Re: Displaying Alarm Times from other functions on: February 07, 2014, 02:01:35 am
I don't know enough about HTTP to give you detailed advice on its use, but if you are worried perhaps that data sent in the way you are doing it will involve several HTTP requests then why not collect  all the data  in an array before sending it in bulk ?
1378  Using Arduino / Programming Questions / Re: Displaying Alarm Times from other functions on: February 06, 2014, 05:53:06 pm
Quote
So if I have to do 3 times of each with the digitalClockdisplay() and the showAlarmTime all within my Trial function as you suggested, would this be the most practical and efficient way of doing this?
I don't agree that it is either practical or efficient but if that is the way you want to do it then it is, of course, OK with me.
1379  Using Arduino / Programming Questions / Re: Using client.print in multiple functions within the same call on: February 06, 2014, 01:15:57 pm
I have replied to the specific question in the other thread.
1380  Using Arduino / Programming Questions / Re: Displaying Alarm Times from other functions on: February 06, 2014, 01:14:47 pm
It sounds like you want everything to happen in the Trial() function.  You can do that if you really must, but it will mean putting the code currently in the showAlarmTime() in the function 3 times along with the code from digitalClockDisplay() 3 times.  Do you really want to do that, and if so, why ?
Pages: 1 ... 90 91 [92] 93 94 ... 285