Pages: [1] 2 3 ... 10
 on: Today at 04:42:22 pm 
Started by blaxxun - Last post by blaxxun

I read already a lot in the last days and found plenty of code for GPS parsing.
Like this:

// This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(

I don't completly understand a few things in this code.
1. Why are there no {}  in "while" and "if" ?  Is this kind of sloppy shortcut programming?
2. Why is my "gps.encode(;" also exiting the "while" loop? Because it gets smaller than zero?
3. Even if i use " if (gps.encode(" in the while loop my code doesn't work as it should.

while (Serial1.available() >0)               // As long as data arrives Do the loop
if(gps.encode(;       // If TRUE exit the while loop

This makes me think.
What if the MEGA arrives in the while loop when an already started, incomplete sentence was sent?
Then it still does the loop because serial1.available is still > 0
Then it gets the encode() = TRUE and exits the loop
The result is a incomplete sentence of GPS data.

Am i right so far?

 on: Today at 04:42:16 pm 
Started by LastSamurai - Last post by LastSamurai
Danke für die schnellen Antworten!
Ich hab jetzt hierfür erstmal jumper wires genommen. Aber das ist eigentlich noch nicht meine Lieblingslösung. Wenn man "echte" Steckverbindungen mit kompletten Kabeln und Steckern (ich kann weder crimpen, noch habe ich das Geld für eine entsprechende Zange ausgegeben bis jetzt) muss es doch bestimmt eine fertige und einigermaßen preiswerte Lösung bei Reichelt und co. geben oder?!

Oder man nimmt doch solche Stecker wie Serenifly verlinkt hat. Aber was genau für ein Equipment braucht man denn um die entsprechenden Kabel dafür crimpen?

 on: Today at 04:42:01 pm 
Started by javedmemon88 - Last post by javedmemon88
Stanley Cup 2014 Live Stream
NHL Playoffs 2014 Live Stream
Watch NHL Playoffs 2014 Online
Philadelphia Flyers vs New York Rangers Live Stream
Watch NY Rangers vs Philadelphia Flyers Online
Chicago Blackhawks vs St Louis Blues Live Stream
Watch Chicago Blackhawks vs St Louis Blues Online
Watch Chicago Blackhawks vs St Louis Blues Online
St Louis Blues vs Chicago Blackhawks Live Stream
Minnesota Wild vs Colorado Avalanche Live Stream
Watch Colorado Avalanche vs Minnesota Wild Online
Los Angeles Kings vs San Jose Sharks Live Stream
Watch LA Kings vs San Jose Sharks Online
Watch Divergent Online Free
Watch Divergent Online Free
Watch Rio 2 Online Free
Watch Rio 2 Online Free
Watch Captain America 2 Online Free
Watch Captain America 2 Online Free
Watch Transcendence Online
Watch Transcendence Online
Watch Transcendence Online Free
Watch Transcendence Online Free
The Vampire Diaries Season 5 Episode 18 Live Stream
Watch The Vampire Diaries Season 5 Episode 18 Online Free
Watch The Vampire Diaries Season 5 Episode 18 Repeat
Scandal Season 3 Episode 18 Finale Live Stream
Watch Scandal Season 3 Episode 18 Online Free
Watch Scandal Season 3 Episode 18 Repeat

 on: Today at 04:41:25 pm 
Started by wcb98 - Last post by Grumpy_Mike
will this melt the duct tape if I tape it with them?
No. Duct tape is fine if a little messy.

 on: Today at 04:41:25 pm 
Started by Jay98 - Last post by Jay98
Ty ty, I think I have covered the wiring part, what I would like to see is the logic.
If I understand it correctly it's something like:

disable outputs
send a byte with the segments status
enable outputs

Is this correct?
I think I can get it really fast if I can get a commented piece of code, what is i'm looking for.

 on: Today at 04:39:54 pm 
Started by wcb98 - Last post by LarryD
Buy some heat shrink tubing.
Solder connections.
Shrink the tubing over your soldering.

 on: Today at 04:36:44 pm 
Started by adt222 - Last post by adt222
Hi guys new to the forum but I'm stuck and was hoping for some expertise. Now before I start I will say my coding knowledge is somewhat limited so please keep it simple on the replies or I'll just be asking loads of stupid questions. So basically I'm trying to calculate the slope of a line using 2 reading for 2 different sensors spaced a set time apart. So the formula is
Where x1 and y1 are the first reading from each sensor and  x2 and y2 are the second reading. This is run in a loop using an array to store the first readings. I think I have it working right but when it calculates the slope is keeps rounding off to a integer and I don't know why. Even when I set the float to 6 decimal places it still does it. I've only added serial print after each section to check the code. I'm sure this is some simple but I can't figure it out or maybe I've just gone the completely wrong way with this program.

const int numReadings = 4;

int readings[numReadings];      // the readings from the analog input
int index = 0;                  // the index of the current reading
int slope = 0;                // the average
int input1Pin = A0;           // set A0 to input pin
int input1Value = 0;
int input2Pin = A1;
int input2Value = 0;
int shaftforce = 0;
int displacement = 0;
void setup()
  // initialize serial communication with computer:
  // initialize all the readings to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;          
void loop() {
  int sensor1Value = analogRead(A0);
  float shaftforce = sensor1Value * (5.0/1023.0);
  int sensor2Value = analogRead(A1);
  float displacement = sensor2Value * (5.0/1023.0);
   // read from the sensor:  
  readings[0] = (analogRead(A0));
 readings[2] = (analogRead(A1));
   delay (1000);
  readings[1] = (analogRead(A0));
  readings[3] = (analogRead(A1));
  float slope = (readings[1]-readings[0])/(readings[3]-readings[2]);
  Serial.println(slope, 6);  
  // if we're at the end of the array...
  if (index >= numReadings)              
    // ...wrap around to the beginning:
    index = 0;                          

  // calculate the average:

  // send it to the computer as ASCII digits
  delay(1000);        // delay in between reads for stability            

 on: Today at 04:36:07 pm 
Started by Black_Ware - Last post by Black_Ware
Content de savoir que je ne suis pas le seul à galérer x)
J'essaye juste de me procurer une télécommande rts pas chère depuis un petit bout de temps pour pouvoir souder dessus sans prendre le risque de tuer ma seul télécomande (et donc mon volet par la même occas  smiley-mr-green et puis comme ça, c'est moins bourrin) Puis j'essayerais de jeter un coup d'oeil du coté de la rom et de l'eeprom voir si il n'y a pas quelque chose d'intéressant  smiley-evil

Cependant comme je ne suis pas un pro dans ce domaine ^^ je risque de patauger un chouil au début  smiley-fat

 on: Today at 04:35:37 pm 
Started by loop_1 - Last post by loop_1
Spiego cosa devo fare: premo il pulsante in pin8 ed avvio un ciclo per cui il led al pin2 si accende per 2 secondi, poi si spegne e dopo 2 secondi si accende il led al pin 3 per altri 2 secondi e si spegne anche quest'ultimo.
Bene ora per riavviare il ciclo come faccio?

non so se sbaglio qualcosa nella programmazione o mi manca a me qualche nozione...

ecco il codice:

#define LED1 2                // LED collegato al pin digitale 2 
#define LED2 3                // LED collegato al pin digitale 3   
#define BUTTON 8              // pin di input dove è collegato il pulsante 
int val = 0;                  // si userà val per conservare lo stato del pin di input 
int vecchio_val = 0;          // si userà vecchio_val per conservare lo stato del pin di input al passo precedente
int stato = 0;                // ricorda lo stato in cui si trova il led, stato = 0 led
int counter1 = 0;
int counter2 = 0;

void setup() { 
  pinMode(LED1, OUTPUT);       // imposta il pin digitale come output
  pinMode(LED2, OUTPUT);       // imposta il pin digitale come output 
  pinMode(BUTTON, INPUT);     // imposta il pin digitale come input 

void loop() {
  val = digitalRead(BUTTON);  // legge il valore dell'input e lo conserva 
  if ((val == HIGH) && (vecchio_val == LOW)){  // controlla se è accaduto qualcosa a val
    stato = 1 - stato; 
    delay(15);                // attesa di 15 millisecondi 

  vecchio_val = val;            // ricordiamo il valore precedente di val 

    if (stato == 1 && counter1 < 1) { 
      digitalWrite(LED1, HIGH);   // accende il led 1
      counter1 = counter1 + 1;
      digitalWrite(LED1, LOW);
  else { 
    digitalWrite(LED1, LOW);    //spegne il led 1
     if (stato == 1 && counter2 < 1) { 
      digitalWrite(LED2, HIGH);   // accende il led 1
      counter2 = counter2 + 1;
      digitalWrite(LED2, LOW);
  else { 
    digitalWrite(LED2, LOW);    //spegne il led 1

 on: Today at 04:33:17 pm 
Started by Amalitus_I - Last post by Amalitus_I
Your code...
while(key = keyPad.getKey() == NO_KEY)
    // Do nothing
// Use key

Doesn't compiles... gives an error that now I don't remeber. But when I change to:

while(keypad.getKey() == NO_KEY)
    // Do nothing
if(keypad.getKey()!= NO_KEY);
 char key = keypad.getKey();
 int myInt = key;
 Serial.println("You have pressed ");
 Serial.println("The corresponding number is ");
 myNum[i]= myInt;
 i = i+1;

You can check that even I have left the "// Do nothing" of your code... But now compiles...
And is giving back "0000"
I don't see where I'm calling key so many times as you say. First I read as a character the keypad is giving me, and the change to a number int temporary, and with this temporary int, create the differente digits of the number... But only reading the key once.
Explain better my fail or better your code...


Pages: [1] 2 3 ... 10