I’m trying to use this library with a teensy 3.2:
I’m not sure why, but it causes the RN2903 modem to reset over and over and even my teensy board resets and goes into some weird condition where I can’t reprogram it unless I load a simple blink sketch onto it.
Any ideas what could be causing it? My code is pretty simple…
#include <TheThingsNetwork.h> /* Serial debugging */ #define debugSerial Serial #define DEBUG_SERIAL_BAUD 57600 /* LoraWAN */ const char *appEui = "70B3D57ED000ACAB"; const char *appKey = "6C19B3357B72BCC89F3C5170DAB60FFD"; #define loraSerial Serial1 #define freqPlan TTN_FP_US915 #define LORA_SERIAL_BAUD 57600 TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan); void setup() { debugSerial.begin(DEBUG_SERIAL_BAUD); loraSerial.begin(LORA_SERIAL_BAUD); while (!debugSerial && millis() < 10000); /* reset modem */ pinMode(21, OUTPUT); digitalWrite(21, LOW); delay(1000); digitalWrite(21, HIGH); delay(1000); while (!loraSerial && millis() < 10000); debugSerial.println("-- STATUS"); ttn.showStatus(); delay(3000); debugSerial.println("-- JOIN"); ttn.join(appEui, appKey); } void loop() { delay(1000); int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (3.3 / 1023.0) * 6; // print out the value you read: Serial.println(voltage); }
Link to a video showing what is going on (causes the device to power cycle over and over)