#arduino just gives up after starting the program

23 messages · Page 1 of 1 (latest)

lone bramble
#

It firstly sends two test messages, but after that it just gives up trying to do anything, the TX and RX leds aren't even blinking. Source code below.

quartz berryBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

sweet ginkgo
#

!f

quartz berryBOT
#

#include <EEPROM.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h>

// definição de pinos
int RXPin = 2;
int TXPin = 3;
int address = 0;
int GPSBaud = 9600;

TinyGPSPlus gps;

SoftwareSerial gpsSerial(RXPin, TXPin);

void setup() {
  Serial.println("test");
  Serial.begin(9600);
  pinMode(4, INPUT);
  // iniciates serial port
  gpsSerial.begin(GPSBaud);
}

void loop() {
  while (gpsSerial.available() > 0)
    if (gps.encode(gpsSerial.read()))
      displayInfo();

  // show error if it can't read anything in 5 seconds
  if (millis() > 5000 && gps.charsProcessed() < 10) {
    Serial.println("Sinal GPS não detectado");
    while (true)
      ;
  }
}

void displayInfo() {
  if (gps.location.isValid()) {
    float Lat = (float)gps.location.lat();
    float Lng = (float)gps.location.lng();
    EEPROM.put(address, Lat);
    address += 4;
    EEPROM.put(address, Lng);
    address += 4;
    Serial.println(Lat, 6);
    Serial.println(Lng, 6);
    Serial.println(EEPROM.get(address - 8, Lat), 6);
    Serial.println(EEPROM.get(address - 4, Lng), 6);
    Serial.println(address);
    if (address >= 2040) {
      address = 2032;
    } else
      Serial.println("Location invalid");
  }

  void dumpmem();
  int buttonState = digitalRead(4);
  float value = 0.0;
  if (buttonState == HIGH) {
    for (int index = 0; index < EEPROM.length(); index++) {
      Serial.print(EEPROM.get(index, value), 6);

      EEPROM[index] += 4;
    }
    return;
  }

  delay(6000);
}

vebrun
quartz berryBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.

still python
lone bramble
#

It was working perfectly a few days ago

#

It compiles with no errors and I got my pins right

still python
#

what's with the while (true);

#

infinite loops with no side effects are UB in C++

#

so the compiler would likely optimize out that entire if-statement if you compiled this with optimizations

lone bramble
#

Is that what is breaking the program?

still python
#

unlikely, if it was working before

#

but it's something that doesn't belong there in general

thorn cypress
#
  • it doesn't work indoors
lone bramble
#

I know it doesn't

#

It was outside my window

#

I think I maybe fried it

#

But not a re because it still blinks the led

thorn cypress
#

are you using a neo 6m?

lone bramble
#

Yeah, specifically the v2

quartz berryBOT
#

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.