Show Posts
Pages: [1] 2 3 ... 68
1  Using Arduino / Programming Questions / Re: Loop & variable name suggestions? on: Today at 04:41:29 pm
Hello smiley

Use an array!
2  Using Arduino / Programming Questions / Re: Board RESET upon serial comm intialization(Mega 2560) on: Today at 04:39:24 pm
I'm connecting to "serial" via USB port so...

You can buy on ebay a USB to TTL converter (search for "PL2303"), for less than 2€ smiley-wink
3  Using Arduino / Programming Questions / Re: Board RESET upon serial comm intialization(Mega 2560) on: August 30, 2014, 08:03:43 pm
It will reset your arduino mega only if you use RX0/TX0. It won't reset with the other serial ports smiley-wink
4  Using Arduino / Programming Questions / Re: Arduino IDE serial communication on: August 27, 2014, 04:58:36 am
As of now I have the RX/TX of the atmega conneected to RX3/TX3 of the arduino.

I don't know if that's the case, but RX must be connected to TX3, and TX to RX3.

And also, for the Mega code, you must use Serial3.begin and Serial3.available.
5  International / Français / Re: Comment puis-je récupérer des string séparé par des espaces on: August 24, 2014, 05:05:32 pm
Si tu tiens absolument à utiliser une regex, ceci pourrait t'intéresser smiley-wink

http://www.gammon.com.au/forum/?id=11063
6  Using Arduino / Project Guidance / Re: Arduino Mega 2560, what all pins can I use? on: August 23, 2014, 01:54:43 am
Very nice smiley-wink
7  Using Arduino / Programming Questions / Re: Using C++ header files on: August 20, 2014, 05:37:11 pm
Send the analog values by Serial, to a custom program on your computer, that will write those values into a file on your hard drive. If you have Windows on your computer, I recommend that you write the program in C#, much easier and faster to learn, than C++.
8  Using Arduino / Programming Questions / Re: Parse a serial string on: August 18, 2014, 01:06:34 pm
I understand it can be hard for beginners... This example will read everything available in the Serial buffer until a "\r" is found, and then will try to parse as you described:
Code:
void loop()
{
  // if there is something in the serial buffer
  if ( Serial.available() > 0 )
  {
    static char input[64];
    static uint8_t i;

    // read one character
    char c = Serial.read();

    // if the character is not a "\r" and the input buffer is not full
    if ( c != '\r' && i < 64-1)
    {
      // store the character at the end of the input buffer
      input[i++] = c;
    }

    // else, the input is ready to be processed
    else
    {
      // add a null terminator to make it a valid C string
      input[i] = '\0';
      //reset index for the next serial message
      i = 0;
      
      // try parsing the input as you described
      uint8_t xx;
      uint16_t yy;
 
      if ( sscanf( input, "$ABDATA,%hhu,%hu", &xx, &yy ) == 2 )
      {
        Serial.println( xx );
        Serial.println( yy );
      }
    }
  }
}
9  Using Arduino / Programming Questions / Re: Parse a serial string on: August 18, 2014, 12:43:51 pm
Hello and welcome smiley

The easiest way is to use sscanf
10  Using Arduino / Programming Questions / Re: Adapting code to what I really want... (thermistor+lcd) on: August 17, 2014, 10:28:08 pm
Hello and welcome smiley

To calculate an average temp you need to add some samples together, and then divide the result by the number of samples.

For example:
Code:
float counter = 0.0;
uint8_t samples = 0;
float averageTemperature = 0.0;
...
//every time you get the temperature from the thermistor
counter += currentTemperature;
samples ++;
averageTemperature = counter / samples;
// don't count too much...
if ( samples > 100 )
{
    samples = 1;
    counter = averageTemperature;
}
(this is untested)

For the max temp, you need to periodically compare the current value with a variable. If the current value is greater than the variable, then you store it in that variable.

For example:
Code:
float maxTemperature = 0.0;
...
if ( currentTemperature > maxTemperature )
{
    maxTemperature = currentTemperature;
}

You may want to save/load this max temp value to/from EEPROM so that you don't lose it when the arduino is reset.
11  Using Arduino / Project Guidance / Re: House plant watering bot on: August 17, 2014, 02:53:23 pm
Maybe you aren't interested, or maybe you don't know, but you can water plants without the need of any electricity. Google "Tropf Blumat".

I'm using this ingenious thing since a few years and it's working perfectly smiley-wink
12  International / Le bar / Re: Presentez vous on: August 17, 2014, 01:51:28 pm
Bienvenue à tous et toutes, au plaisir de vous aider si je le peux smiley-wink
13  International / Français / Re: Problème avec la bibliothèque SD on: August 17, 2014, 01:34:14 am
Bonjour,

Le "const" devant un paramètre de fonction ne sert que d'indicateur, il indique aux utilisateurs de cette librairie (ainsi qu'au compilateur, qui optimisera un peu cette fonction) que ce paramètre ne sera pas modifié dans la fonction. Tu peux utiliser une variable sans soucis.
14  International / Français / Re: Problème de débutant on: August 14, 2014, 03:01:11 pm
Ca peut aussi servir à inverser la valeur d'un bool
Code:
bool = !bool;

C'est bien pratique desfois smiley-wink
15  Using Arduino / Programming Questions / Re: Hello computer, how loud are you? on: August 14, 2014, 02:37:32 pm
It should be easy enough if you use Windows and know C# programming. Here is what I found:

http://www.codeproject.com/Articles/18520/Vista-Core-Audio-API-Master-Volume-Control

You then need to add a Serialport object to communicate with your Arduino.
Pages: [1] 2 3 ... 68