text:
Can I operate an arduino that has a file uploaded on it, without having the file myself?
I've been a massive idiot and accidentally deleted the sketch I need for a project at university, and I didn't create any backups. The sketch is already uploaded into the arduino, which operates using the serial monitor; when "1" is entered it does one thing, when "2" is entered it does another thing and so on. My question is: can I still use the serial monitor to operate the arduino without having the original sketch?
Any help would be appreciated, thank you.

Of course you can. The serial monitor has nothing to do with the sketch - it's just a very primitive serial interface program.
You don't even need the serial monitor. You can use any serial interface program ("terminal emulator") such as Teraterm, Putty, Hyperterminal, etc.


text:
Is there something wrong in my sketch?
I've been working on a project that need two sensors(mq2 and mpu6050), I got each sketches from the internet and I managed to work the mq2 but for the mpu6050, I'm still not sure if its working. The thing is I want the two sensors to work on their own but in one sketch. When the mq2 senses some gas, I want the LED and BUZZER turned on and the only way to turn it off is by resetting the arduino. For the MPU6050, it's the same with the mq2, when the MP6050 is triggered, I want the other LED and the same buzzer turn on, again the only way to turn it off is by resetting the arduino. I want to combine the se two skectches in one. But when I combined it, the circuit won't work. Could someone help me ?
Here is the code that I modified and combined:
#include <Wire.h>
#include <MPU6050.h>

#define minval -5
#define maxval 3

MPU6050 mpu;
//////////////////////////////////////////////////////////////////

//for mq2

int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 100;

//////////////////////////////////////////////////////////////////

void setup(){
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  mpu.setThreshold(3);
}

//////////////////////////////////////////////////////////////////

void loop(){
  // for mq2

  int analogSensor = analogRead(smokeA0);

  // Checks if it has reached the threshold value
  if (analogSensor > sensorThres)
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
    tone(buzzer, 1000);
  }
  else{
  digitalWrite(greenLed, HIGH);
  }
  // for MPU6050

  Vector rawGyro = mpu.readRawGyro();
  Vector normGyro = mpu.readNormalizeGyro();
  if (normGyro.XAxis > maxval ||
      normGyro.XAxis < minval &&
      normGyro.YAxis > maxval ||
      normGyro.YAxis  < minval &&
      normGyro.ZAxis > maxval ||
      normGyro.ZAxis  < minval)
  {
    digitalWrite(7,HIGH);
    digitalWrite(8,HIGH);
  }
  else
  {
    digitalWrite(7,LOW);
    digitalWrite(8,LOW);
  }

}

Here is the code for the mq2:
int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 150;

void setup() {
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(smokeA0, INPUT);
}

void loop() {
  int analogSensor = analogRead(smokeA0);

  // Checks if it has reached the threshold value
  if (analogSensor > sensorThres)
  {
    digitalWrite(redLed, HIGH);
    digitalWrite(greenLed, LOW);
    tone(buzzer, 1000);
  }
  else{
  digitalWrite(greenLed, HIGH);
  delay(100);
  }
}

Here is the code for the MPU6050(I removed some lines when I put it at the combined sketch because I dont need the LCD code, dunno if I did it correct):
#include <Wire.h>
#include <MPU6050.h>

#define minval -5
#define maxval 3

MPU6050 mpu;

void setup()
{
  Serial.begin(115200);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);

  delay (2000);

  // Initialize MPU6050
  Serial.println("Initialize MPU6050");

  while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
  {
    Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
    delay(500);
  }

  mpu.setThreshold(3);
  // Check settings
  checkSettings();
}

void checkSettings()
{
  Serial.println();
  Serial.print(" * Sleep Mode:        ");
  Serial.println(mpu.getSleepEnabled() ? "Enabled" : "Disabled");
  Serial.print(" * Clock Source:      ");
  switch(mpu.getClockSource())
  {
    case MPU6050_CLOCK_KEEP_RESET:
      Serial.println("Stops the clock and keeps the timing generator in reset");
      break;
    case MPU6050_CLOCK_EXTERNAL_19MHZ:
      Serial.println("PLL with external 19.2MHz reference");
      break;
    case MPU6050_CLOCK_EXTERNAL_32KHZ:
      Serial.println("PLL with external 32.768kHz reference");
      break;
    case MPU6050_CLOCK_PLL_ZGYRO:
      Serial.println("PLL with Z axis gyroscope reference");
      break;
    case MPU6050_CLOCK_PLL_YGYRO:
      Serial.println("PLL with Y axis gyroscope reference");
      break;
    case MPU6050_CLOCK_PLL_XGYRO:
      Serial.println("PLL with X axis gyroscope reference");
      break;
    case MPU6050_CLOCK_INTERNAL_8MHZ:
      Serial.println("Internal 8MHz oscillator");
      break;
  }

  Serial.print(" * Gyroscope:         ");
  switch(mpu.getScale())
  {
    case MPU6050_SCALE_2000DPS:
      Serial.println("2000 dps");
      break;
    case MPU6050_SCALE_1000DPS:
      Serial.println("1000 dps");
      break;
    case MPU6050_SCALE_500DPS:
       Serial.println("500 dps");
       break;
    case MPU6050_SCALE_250DPS:
       Serial.println("250 dps");
       break;
  }

  Serial.print(" * Gyroscope offsets: ");
  Serial.print(mpu.getGyroOffsetX());
  Serial.print(" / ");
  Serial.print(mpu.getGyroOffsetY());
  Serial.print(" / ");
  Serial.println(mpu.getGyroOffsetZ());
  Serial.println();
}

void loop()
{
  Vector rawGyro = mpu.readRawGyro();
  Vector normGyro = mpu.readNormalizeGyro();
  Serial.print(" Xraw = ");
  Serial.print(rawGyro.XAxis);
  Serial.print(" Yraw = ");
  Serial.print(rawGyro.YAxis);
  Serial.print(" Zraw = ");
  Serial.println(rawGyro.ZAxis);

  if (normGyro.XAxis > maxval ||
      normGyro.XAxis < minval &&
      normGyro.YAxis > maxval ||
      normGyro.YAxis  < minval &&
      normGyro.ZAxis > maxval ||
      normGyro.ZAxis  < minval)
  {
    digitalWrite(7,HIGH);
    digitalWrite(8,HIGH);
    delay(300);
    digitalWrite(7,HIGH);
    digitalWrite(8,HIGH);
    delay(300);
    delay (1000);
  }
  else
  {
    digitalWrite(7,LOW);
    digitalWrite(8,LOW);
  }
  Serial.print(" Xnorm = ");
  Serial.print(normGyro.XAxis);
  Serial.print(" Ynorm = ");
  Serial.print(normGyro.YAxis);
  Serial.print(" Znorm = ");
  Serial.println(normGyro.ZAxis);
  delay(10);
}

The i2c bus uses a4 and a5 for sda and scl. You can still use a0 up to a3 for the mq2 sensor. With some luck, nothing is broken yet, but keep in mind that the mpu6050 is a 3.3v sensor.

only you can decide if your sketch is working ..... if it does something that you do not want it to do, then it is not working ....... not working is a meaningless description of the program behavior ...... if you want real help then you should describe exactly what the program does and what you want it to do

Ok, I'll edit my post

@jsotola could you help me ?

@HamdanieImpa, did you understand my answer? You can read about the used pin numbers also on this page: https://www.arduino.cc/en/Reference/Wire

your description of the desired behavior is very good now ...... your description of the observed results is still vague .... do you mean that no buzzer sounds and no LEDs light? .... does any part work?

read @Jot's first comment ..... then look at this command line int smokeA0 = A5; ..... that is the conflict

@Jot, formulate your first comment as an answer .... the OP must have a 3.3V arduino because the sensor works with a separate sketch

The Arduino Uno has the special functions on fixed pins.
The I2C bus, for example, uses pin A4 and A5.
In the Arduino Wire reference page is a table of the pin numbers for the Arduino boards.
The pins called "SDA" and "SCL" near the USB connector are connected to the pins "A4" and "A5" (for an Arduino Uno).
That means that if you use the I2C bus, you may not use pin "A4" and "A5" for something else.
Connect the MQ2 gas sensor to pin A0, A1, A2 or A3, and it should work.
The MPU-6050 is an old sensor, there are newer and better sensors with less noise.
The MPU-6050 is a 3.3V sensor, that means its power should be 3.3V and the I2C bus should have 3.3V levels.
The Arduino Uno has a microcontroller that runs at 5V, and therefor it has a I2C bus with 5V levels.
A I2C level shifter can be used to connect the Arduino Uno with the MPU-6050. You can also use 4k7 pullup resistors from SDA to 3.3V and from SCL to 3.3V. Those pullup resistors are often already on the MPU-6050 module.
The MPU-6050 will work (for some time) with a I2C bus that has 5V levels, it might even work when the MPU-6050 is powered with 5V directly to the chip. That will influence the data, and the sensor might get damaged. Newer 3.3V sensor chips are often faster damaged with 5V, but don't push your luck with the MPU-6050.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
How to stop a linear actuator?
I wrote code but the motor does not stop, it keeps moving.
Can anyone send code so that I can stop the motor after my code shown below?
const int forwards = 7;
const int backwards = 6;//assign relay INx pin to arduino pin

void setup() {
  pinMode(forwards, OUTPUT);//set relay as an output
  pinMode(backwards, OUTPUT);//set relay as an output
}

void loop() {
 digitalWrite(forwards, LOW);
 digitalWrite(backwards, HIGH);//Activate the relay one direction, they must be different to move the motor
 delay(20000); // wait 2 seconds

 digitalWrite(forwards, HIGH);
 digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
 delay(2000);// wait 2 seconds

 digitalWrite(forwards, HIGH);
 digitalWrite(backwards, LOW);//Activate the relay the other direction, they must be different to move the motor
 delay(20000);// wait 2 seconds

 digitalWrite(forwards, HIGH);
 digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
 delay(2000);// wait 2 seconds
}

Move your code out of loop() (where it loops) and into setup() where it only runs once?

It's not working..

Then you must have done something wrong.

motor does not stop ..... what does the motor do? ...... what is it supposed to do?

you are waiting 20 seconds instead of 2

There's multiple things you can do.  Here's some examples.
1: Move code out of loop() and intosetup():
const int forwards = 7;
const int backwards = 6;//assign relay INx pin to arduino pin

void setup() {
    pinMode(forwards, OUTPUT);//set relay as an output
    pinMode(backwards, OUTPUT);//set relay as an output

    digitalWrite(forwards, LOW);
    digitalWrite(backwards, HIGH);//Activate the relay one direction, they must be different to move the motor
    delay(20000); // wait 2 seconds

    digitalWrite(forwards, HIGH);
    digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
    delay(2000);// wait 2 seconds

    digitalWrite(forwards, HIGH);
    digitalWrite(backwards, LOW);//Activate the relay the other direction, they must be different to move the motor
    delay(20000);// wait 2 seconds

    digitalWrite(forwards, HIGH);
    digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
    delay(2000);// wait 2 seconds
}

void loop() {
}

2: Stop loop() from looping:
const int forwards = 7;
const int backwards = 6;//assign relay INx pin to arduino pin

void setup() {
    pinMode(forwards, OUTPUT);//set relay as an output
    pinMode(backwards, OUTPUT);//set relay as an output
}

void loop() {

    digitalWrite(forwards, LOW);
    digitalWrite(backwards, HIGH);//Activate the relay one direction, they must be different to move the motor
    delay(20000); // wait 2 seconds

    digitalWrite(forwards, HIGH);
    digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
    delay(2000);// wait 2 seconds

    digitalWrite(forwards, HIGH);
    digitalWrite(backwards, LOW);//Activate the relay the other direction, they must be different to move the motor
    delay(20000);// wait 2 seconds

    digitalWrite(forwards, HIGH);
    digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
    delay(2000);// wait 2 seconds

    while (1); // Stop here and do nothing forever
}

3: Set a "I have done it" flag:
const int forwards = 7;
const int backwards = 6;//assign relay INx pin to arduino pin
bool complete = false;

void setup() {
    pinMode(forwards, OUTPUT);//set relay as an output
    pinMode(backwards, OUTPUT);//set relay as an output
}

void loop() {
    if (!complete) {
        digitalWrite(forwards, LOW);
        digitalWrite(backwards, HIGH);//Activate the relay one direction, they must be different to move the motor
        delay(20000); // wait 2 seconds

        digitalWrite(forwards, HIGH);
        digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
        delay(2000);// wait 2 seconds

        digitalWrite(forwards, HIGH);
        digitalWrite(backwards, LOW);//Activate the relay the other direction, they must be different to move the motor
        delay(20000);// wait 2 seconds

        digitalWrite(forwards, HIGH);
        digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
        delay(2000);// wait 2 seconds

        complete = true;
    }
}

Each has benefits and drawbacks. Which is right for you depends on what you are actually trying to achieve.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
ESP32 stops looping after 2 loops
My code: https://pastebin.com/UmdK33U2
I made a menu so I can send commands. First I connect to the wifi and then I send the command to send a request.
Then when it detects the key datos(); goes true, so the loop detects that and it starts sending requests.
After 2 requests it just doesnt continue.
What I can do?
Btw im using a ESP32.
Thank you!
boolean datos = false;

#include <WiFi.h>
#include <HTTPClient.h>

const char* ssid = "ssid";
const char* password = "pass";

//removed the password and ssid for security, it was there before.
void setup() {
  pinMode(2, OUTPUT);
  Serial.begin(115200);

  while (!Serial)
    ;
  Serial.println("===================================================");
  Serial.println("Welcome to the menu, choose what do you want to do:");
  Serial.println("1º Connect to the Wifi | W");
  Serial.println("2º Scan Wifi | S");
  Serial.println("3º Send data to Website | D");
  Serial.println("===================================================");
  Serial.println("Made by Francine and Javi.");
  Serial.println("===================================================");
}

void scanwifi() {
  int n = WiFi.scanNetworks();
  Serial.println("===================================================");
  Serial.println("Scan have been finished.");
  Serial.println("===================================================");
  if (n == 0) {
    Serial.println("===================================================");
    Serial.println("No networks have been found.");
    Serial.println("===================================================");
  } else {
    Serial.print(n); // imprimir en el puerto serial el # de redes encontradas
    Serial.println(" networks have been found.");
    for (int i = 0; i < n; ++i) {
      // SSID: Nombre de la red; RSSI: Potencia de la red en dBm
      Serial.print(i + 1); //iniciamos en la red # 1...
      Serial.print(": ");
      Serial.print(WiFi.SSID(i)); //Imprime el nombre de la red
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i)); //Imprime la potencia de la señal en dBm
      Serial.print(")");
      byte encryption = WiFi.encryptionType(i); // en la variable encryption, guardamos el tipo de encriptación de la red
      Serial.print(" Encryption Type: ");
      Serial.println(encryption, HEX); // imprimimos el tipo de encriptación: 2: WPA, 5: WEP, etc.
      delay(10);
    }
  }
}

void conectarsealwifi() {
  Serial.begin(115200);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);

    Serial.println("Connecting to WiFi..");
  }

  Serial.println("Connected to the WiFi network");
  delay(1000);
  setup();
}

void loop() {
  if (Serial.available()) {
    char ch = Serial.read();
    if (ch == 'w' || ch == 'W') {
      conectarsealwifi();
    }
    if (ch == 'S' || ch == 's') {
      scanwifi();
    }
    if (ch == 'd' || ch == 'D') {
      datos = true;
      Serial.println(datos);
    }
    if (datos == true) { // si esta habilitado el sending de datos haz
      //randomN = random(200);
      if (WiFi.status() == WL_CONNECTED) {
        digitalWrite(2, HIGH);
        HTTPClient http;

        http.begin("removedtheurl"); //Specify the URL
        int httpCode = http.GET();                            //Make the request

        if (httpCode > 0) { //Check for the returning code

          String payload = http.getString();
          Serial.println(httpCode);
          Serial.println(payload);
          Serial.println("===================================================");

        } else {
          Serial.println(
              "Error on HTTP request, reminder maybe its cloudflare shit.");
        }
        http.end(); //Free the resources
        digitalWrite(2, LOW);
      }
      delay(2000);

    } else {

    }
  }
}

If you fix your indenting you'll soon find your problem.

@Majenko Hi, thank you for responding. I dont understand your response, im not a foreign speaker, mind explaining better the solution to my problem?

The basic layout (indenting) of your program is a mess. If you fix that and lay it out properly you will be able to follow the flow of your program better, and the reason for its behaviour will become apparant.

@Majenko What I checked is that if I type nothing and I send it the loops continues for 1 row then bakc to normal.

I know. I can see that by just looking at the flow of your program (after fixing the indenting). If you don't know how to indent properly then please use the auto-format facility in the IDE to do it for you.

Incidentally, I see that Juraj has fixed it for you in your post. Take a look at that version and tell me where the problem is.

You send from Serial Monitor a character followed by a new line character. This two characters are available. Nothing more to enter the if (Serial.available()) { block.

Thank you for your response. How can I apply it on my code?

by moving the if (datos) { block out of if (Serial.available()) { block?

Thank you, it is working. Have a good day.


text:
Ultrasonic sensor showing weird reading
When i run a test code in Newping library for ultrasonic sensor SR04 then in works properly but when i run the actual code for obstacle avoiding robot then it shows 0 cm everytime. This means that wiring is correct but there is something wrong in my code below
#include <NewPing.h>
#include <AFMotor.h> //import your motor shield library

#define TRIGGER_PIN  12
#define ECHO_PIN     11
#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

AF_DCMotor motor1(1, MOTOR12_64KHZ); // set up motors.
AF_DCMotor motor2(2, MOTOR12_8KHZ);

int distance;

void setup() {
Serial.begin(115200);
}

void loop() {
  delay(50);
  distance = sonar.ping_cm(); // start the scan
  delay(20);
  if (distance < 2) {
   Serial.println("Close Obstacle detected!" );
   Serial.println("Obstacle Details:");
   Serial.print("Distance From Robot is " );
   Serial.print(distance);
   Serial.print( " CM!");// print out the distance in centimeters.
   delay(10);
   Serial.println (" The obstacle is declared a threat due to close distance. ");
   Serial.println (" Turning !");
   motor1.run(FORWARD);  // Turn as long as there's an obstacle ahead.
   motor2.run(BACKWARD);

}
  else {
   Serial.println("No obstacle detected. going forward");
   delay(15);
   motor1.run(FORWARD); //if there's no obstacle ahead, Go Forward!
   motor2.run(FORWARD);
  }
}

Test code for sensor which worked:-
#include <NewPing.h>

#define TRIGGER_PIN  12
#define ECHO_PIN     11
#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup() {
  Serial.begin(115200);
}

void loop() {
  delay(50);
  Serial.print("Ping: ");
  Serial.print(sonar.ping_cm());
  Serial.println("cm");
}

Tell me whats wrong here

Motor Shield used below
Wiring of sensor is connected to Arduino below the shield

replace the whole  if-else loop with Serial.print(distance); .... what does it print now?

The NewPing library returns zero when there is no echo detected. And 2 cm may be too short. If I remember correctly, this is the minimal distance that these sensors can detect.

yes i tried serial.print and showed some reading. But now it goes to 1000cm :|

Try with
unsigned int distance;

Instead of
int distance;

It could also be the motor shield that is using the same pins as your ultrasonic sensor.

Thanks but it didn't work. Using serial.print() instead of distance variable helped.

And your sure that your motor shield is not conflicting ? What make/model is it ?

its like the one in dk electronics. Now again the sensor is showing 0cm so i think you are right. I have done sensor wiring under the shield so is that a good method?

Not sure about the wiring without seeing it. What I would recommend is trying your sketch without the motor shield.

I tried the test code without motor shield and it worked but doesnt work with motor shield on it.

According to this schematic pin 11 and 12 are used by the motor shield: https://forum.arduino.cc/index.php?action=dlattach;topic=211225.0;attach=71519

You could try using A0 and A1 for the sensor. In theory should work. If not you will need to use an Arduino with more I/O like the Arduino Mega 2560


text:
SD Card Read/Write Arduino Mega Fail
I have an Arduino Mega 2560 where I have used a MicroSD Card Module to Read/Write Data on the Micro SD Card.
I have tried using the Example in the Arduino IDE but the data is not being written or read by Arduino to the SD Card Module. The connections with the module is exactly how it is described in the Sketch.
I have attached pictures of the Connection and the module I use for the same.
The Example sketch for the SD Card Read/Write is also attached.
If there is a problem that you can notice, please let me know what the problem is and if it can be solved.
Thank you in advance.
/*
SD card read/write

This example shows how to read and write data to and from an SD card file
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)

created   Nov 2010
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe

This example code is in the public domain.

*/

#include <SPI.h>
#include <SD.h>

 File myFile;

 void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
     while (!Serial) {
        ; // wait for serial port to connect. Needed for native USB port only
      }

 Serial.print("Initializing SD card...");

 if (!SD.begin(4)) {
 Serial.println("initialization failed!");
 return;
  }

  Serial.println("initialization done.");

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
   myFile = SD.open("test.txt", FILE_WRITE);

  // if the file opened okay, write to it:
    if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
    // close the file:
    myFile.close();
    Serial.println("done.");
     } else {
     // if the file didn't open, print an error:
     Serial.println("error opening test.txt");
   }

    // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
   Serial.println("test.txt:");

    // read from the file until there's nothing else in it:
     while (myFile.available()) {
     Serial.write(myFile.read());
     }
    // close the file:
    myFile.close();
     } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
     }
    }

    void loop() {
   // nothing happens after setup
     }

Connection with Arduino
SD Card Module

The SPI wiring described in the SD card example sketch is for Uno. On Mega the SPI pins are 50 MISO, 51 MOSI and 52 CLK.

Is it possible to use 50 MISO, 51 MOSI and 52 CLK and 53 for CS?

SD.begin(53); for 53 as CS for SD card

Thank you so much. I will check with your information and update you.

I am so sorry for the delay. I had tried it and it worked. I could not come back go StackExchange because of getting stuck with other projects. Thank you so much for your help.


text:
strtok keep original char
I want to make a vocab program for an arduino. The vocabs are saved in a char array seperated with an '/'. Now I want to split a random picked char and split it at the '/' so I can save it into two variables. But if I do it with strtok the original string gets sacrificed. If now the same vocab comes again...
I hope you can help me, but if you think a other way to do it would be better I'm open for suggestions.
Here's my code
long random1, random2, random3, random4;
int lengtharray = 5;
char* vocab1;
char* vocab2;
char* vocab3;
char* vocab4;
char* german1;
char* english1;
char vocabs[5][16] = {"Apfel/apple","er/he","Zoo/zoo","sie/she","Hallo/hello"};

void setup() {
Serial.begin(9600); //Debugging
}

void loop() {
randomSeed(analogRead(0));
random1 = random(0,lengtharray);
randomSeed(analogRead(0));
random2 = random(0,lengtharray);
while(random2 == random1){
    randomSeed(analogRead(0));
    random2 = random(0,lengtharray);
}
randomSeed(analogRead(0));
random3 = random(0,lengtharray);
while(random3 == random1 || random3 == random2){
    randomSeed(analogRead(0));
    random3 = random(0,lengtharray);
}
randomSeed(analogRead(0));
random4 = random(0,lengtharray);
while(random4 == random1 || random4 == random2 || random4 == random3){
    randomSeed(analogRead(0));
    random4 = random(0,lengtharray);
}

vocab1 = vocabs[random1];
vocab2 = vocabs[random2];
vocab3 = vocabs[random3];
vocab4 = vocabs[random4];

Serial.println(vocab1);
Serial.println(vocab2);
Serial.println(vocab3);
Serial.println(vocab4);
Serial.println("//");
delay(1000);

german1 = strtok(vocab1,"/");
english1 = strtok(NULL,"/");
Serial.println(german1);
Serial.println(english1);
}

sorry for my english

Personally I would store them as separate words within a struct to pair them up. No splitting required.

Personally I would take a completely different tack. I'd store the word pairs as separate items within a struct:
struct wordpair {
    const char *german;
    const char *english;
};

struct wordpair pairs[] = {
    { "Apfel", "apple" },
    { "er", "he" },
    { "Zoo", "zoo" },
    { "sie", "she" },
    { "Hallo", "hello" },
};

#define NWORDS (sizeof(pairs) / sizeof(pairs[0]))

Now you have instant access to the words.  For example:
pairs[3].german

is "sie", and
pairs[3].english

is "she".
You don't need to waste time splitting words up, since they are already split up.  You don't need to worry about words getting corrupted, because you're never writing anything to the words.  Indeed, if you tried to, because they are tagged as const, the compiler should complain.
So:
struct wordpair *vocab1 = &pairs[random1];

Serial.println(vocab1->german);

The macro NWORDS gives you the size of the array for easy reference.

Make a buffer large enough to hold the largest of the word-pairs. Copy the selected pair into the buffer and run strtok() in that buffer. Strtok will damage the buffer contents but that is a throw-away; the original word-pair string is still unchanged.


text:
Initialize and read from a PROGMEM array of pointers to PROGMEM arrays
I'm working on a project for the arduino uno for which I need multiple constant arrays of bytes. Such an array is initialized like so:
const byte charR[] PROGMEM = {
  B01111111,//top half
  B01111111,
  B01000100,
  B01000110,
  B01101111,
  B00111001,
  B00000000,
  B01111000,//bottom half
  B01111000,
  B00000000,
  B00000000,
  B01111000,
  B01111000,
  B00000000
};

This array represents the capital letter R. I read the nth byte of this array like so:
nth_byte = pgm_read_word(charR+n);

This is all fine and good so far, but now I need to take it a step further. I need to create the array message[]. I need to use message[] to read byte arrays in a certain sequence. For instance:
message[] = {
  charR,
  chare,
  charp,
  charl,
  chary,
  charspace,
  charp,
  charl,
  chare,
  chara,
  chars,
  chare
};

Each entry in message[] refers to a byte array that represents a character. Notice how multiples appear. This is kind of like a 2-D array, but I want to save progmem by only defining each character once.
How do I properly initialize message[]? Will I need to use pointers for this? How do I properly get the array size or yth byte of the xth entry in message[]?

const byte* const message[] PROGMEM =
to use an item, load it in RAM
strcpy_P(buffer, (byte*)pgm_read_word(&(message[i])));
source Arduino reference - PROGMEM

@bo-thompson, did it help?

Sorry for the delay, I've been separated from the microcontroller running this project for the last week. Hopefully I will return to it in the coming week and I will mark this as an answer as soon as I've verified that I can understand and use it.


text:
LB1847 stepper controller :how to connect to grbl atmega based board with step ,direction,enable , limit?
I like to use an LB1847 chip with stepper motor "both salvaged from old copier". I made a GRBL AtMega board, this board gives step, direction, enable and limit leads.
So I tried to find the corresponding pins on the LB1847, but the data sheet only shows enable1 and enable2 pins and phase1 and phase2 pins?
So how can I connect the step and direction and enable pins of AtMega to these pins of LB1847?
There are other logic pins on LB1847 chip to control current and decay.
If the data sheet is required i can upload it.
Thanks in advance

Please provide a link to the datasheet

Link to datasheet: https://www.onsemi.com/pub/Collateral/LB1847-D.PDF

It seems that most people use an Arduino CNC Shield to connect their Arduino Uno (running GRBL software) to the drivers of the stepper-motors. Via Google you find plenty of them, for example: here and here. The schematics of the latter example are published here. You could use the information from this schematic to make your own 'interface' between the Arduino and the LB1847 driver chips.


text:
Look for Master and Slave code with error for a Arduino Mege
I am building a a-10c Sim. So I need lots of input and outputs. Each Arduino has 54 digital i/o and 16 analog inputs in each. As I need more I just add another arduino mega 2560.
I want to thank in advance Im am very new at his, and would welcome any help.
Regards,
Gary
Im am a dyslexic so pls excuse the spelling or bed sentences

I am not sure that I understand what you are planning to build. From the Internet I see that a "10c Sim" is a flight simulation program. Therefore I assume you plan to build some hardware, like flight stick and throttle, to provide the necessary input to the PC on which this sim program runs.
The number of digital i/o and analog inputs you mention is not true for "each Arduino" but only for an Arduino Mega.
To expand the number of i/o pins you could add another Arduino, but this makes the programming (much) more complicated. You could set them up as master and slave, where the master tells the slave which output to perform and the slave tells the master which input came in. Or you can split-up the total system into two subsystems where each Arduino has his own responsibilities to handle it's part of the system. In order not to lose many i/o pins to the connection between both Arduino's, the connection between the two Arduino's has to be serial.
But there are better possibilities to extend the number of i/o-pins. IC's (chips) exist wit a serial input and a number of (parallel) i/o pins. A special case of this are the IC's working with I2C as the serial connection. Look at Google for "i2c port expander".

The same can be said for ADC chips too if you want to expand the analog inputs.


text:
problem related to arduino
first of all, I am not very good at English. if I have done a mistake during describe the problem apologize me. I want to combine both ultrasonic sensor code and mpu6050 sensor. can anyone tell me how to combine both codes in one code?
#include <Wire.h>
//I2C communication library for MPU6050
#include <I2Cdev.h>
//MPU6050 interfacing library
#include <MPU6050_6Axis_MotionApps20.h>
//Processing incoming serial data
#include <CmdMessenger.h>
//Contain definition of maximum limits of various data type
#include <limits.h>

//Creating MPU6050 Object
MPU6050 mpu(0x68);
//Messenger object
CmdMessenger Messenger_Handler = CmdMessenger(Serial);

///////////////////////////////////////////////////////////////////////////////////////
//DMP options
//Set true if DMP init was successful
bool dmpReady = false;
//Holds actual interrupt status byte from MPU
uint8_t mpuIntStatus;
//return status after each device operation
uint8_t devStatus;
//Expected DMP paclet size
uint16_t packetSize;
//count of all bytes currently in FIFO
uint16_t fifoCount;
//FIFO storate buffer
uint8_t fifoBuffer[64];

#define OUTPUT_READABLE_QUATERNION
////////////////////////////////////////////////////////////////////////////////////////////////

//orientation/motion vars
Quaternion q;
VectorInt16 aa;
VectorInt16 aaReal;
VectorInt16 aaWorld;
VectorFloat gravity;

//Euler angle container
float euler[3];

//yaw/pitch/roll container and gravity vector
float ypr[3];

// ================================================================
// ===               INTERRUPT DETECTION ROUTINE                ===
// ================================================================

volatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
void dmpDataReady() {
    mpuInterrupt = true;
}

/////////////////////////////////////////////////////////////////
//Motor Pin definition
//Left Motor pins

#define A_1 3
#define B_1 4

//PWM 1 pin number
#define PWM_1 6

//Right Motor
#define A_2 4
#define B_2 5

//PWM 2 pin number
#define PWM_2 5

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Ultrasonic pins definition
const int echo = 24, Trig = 23;
long duration, cm;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//Motor speed from PC
//Motor left and right speed
float motor_left_speed = 0;
float motor_right_speed = 0;
/////////////////////////////////////////////////////////////////

//Setup serial, encoders, ultrasonic, MPU6050 and Reset functions
void setup()
{

  //Init Serial port with 115200 baud rate
  Serial.begin(115200);

  //Setup Motors
  SetupMotors();
  //Setup Ultrasonic
  SetupUltrasonic();
  //Setup MPU 6050
  Setup_MPU6050();

  //Set up Messenger
//  Messenger_Handler.attach(OnMssageCompleted);

}

void SetupMotors()
{

 //Left motor
 pinMode(A_1,OUTPUT);
 pinMode(B_1,OUTPUT);

 //Right Motor
 pinMode(A_2,OUTPUT);
 pinMode(B_2,OUTPUT);

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Setup UltrasonicsSensor() function
void SetupUltrasonic()
{
 pinMode(Trig, OUTPUT);
 pinMode(echo, INPUT);

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Setup MPU6050 function

void Setup_MPU6050()
{

    Wire.begin();
   // initialize device
    Serial.println("Initializing I2C devices...");
    mpu.initialize();

    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(mpu.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

    //Initialize DMP in MPU 6050
    Setup_MPU6050_DMP();

}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Setup MPU 6050 DMP
void Setup_MPU6050_DMP()
{

     //DMP Initialization

   devStatus = mpu.dmpInitialize();

   mpu.setXGyroOffset(220);
   mpu.setXGyroOffset(76);
   mpu.setXGyroOffset(-85);
   mpu.setXGyroOffset(1788);

   if(devStatus == 0){
         Serial.println(F("Enabling DMP..."));
        mpu.setDMPEnabled(true);
    //mpu.setDMPEnabled(true);

//    pinMode(PUSH2,INPUT_PULLUP);
//    attachInterrupt(PUSH2, dmpDataReady, RISING);

    mpuIntStatus = mpu.getIntStatus();

    dmpReady = true;

    packetSize = mpu.dmpGetFIFOPacketSize();

   }else{

     ;
     }
}

void loop() {

 //Read from Serial port
    Read_From_Serial();

    //Send ultrasonic values through serial port
    Update_Ultra_Sonic();

    //Send MPU 6050 values through serial port
    Update_MPU6050();

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Read from Serial Function

void Read_From_Serial()

{
   while(Serial.available() > 0)
    {

       int data = Serial.read();
//       Messenger_Handler.process(data);

    }

}

void Update_Ultra_Sonic()
{
  digitalWrite(Trig, LOW);
  delayMicroseconds(2);
  digitalWrite(Trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(Trig, LOW);
  // The echo pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  duration = pulseIn(echo, HIGH);

  //Sending through serial port
  Serial.print("u");
  Serial.print("\t");
  Serial.print(cm);
  Serial.print("\n");

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Update MPU6050

void Update_MPU6050()
{

  int16_t ax, ay, az;
  int16_t gx, gy, gz;

    ///Update values from DMP for getting rotation vector
    Update_MPU6050_DMP();

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Update MPU6050 DMP functions

void Update_MPU6050_DMP()
{

 //DMP Processing
 // if programming failed, don't try to do anything
    if (!dmpReady) return;

     // wait for MPU interrupt or extra packet(s) available
    while (!mpuInterrupt && fifoCount < packetSize) {

        ;

          }

// reset interrupt flag and get INT_STATUS byte
    mpuInterrupt = false;
    mpuIntStatus = mpu.getIntStatus();

    //get current FIFO count
    fifoCount = mpu.getFIFOCount();

    // check for overflow (this should never happen unless our code is too inefficient)
    if ((mpuIntStatus & 0x10) || fifoCount > 512) {
        // reset so we can continue cleanly
        mpu.resetFIFO();
    }

// otherwise, check for DMP data ready interrupt (this should happen frequently)
else if (mpuIntStatus & 0x02) {
        // wait for correct available data length, should be a VERY short wait
        while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();

        // read a packet from FIFO
        mpu.getFIFOBytes(fifoBuffer, packetSize);

        // track FIFO count here in case there is > 1 packet available
        // (this lets us immediately read more without waiting for an interrupt)
        fifoCount -= packetSize;

        #ifdef OUTPUT_READABLE_QUATERNION
            // display quaternion values in easy matrix form: w x y z
            mpu.dmpGetQuaternion(&q, fifoBuffer);

            Serial.print("i");Serial.print("\t");
            Serial.print(q.x); Serial.print("\t");
            Serial.print(q.y); Serial.print("\t");
            Serial.print(q.z); Serial.print("\t");
            Serial.print(q.w);
            Serial.print("\n");

        #endif

        #ifdef OUTPUT_READABLE_EULER
            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetEuler(euler, &q);
            Serial.print("euler\t");
            Serial.print(euler[0] * 180/M_PI);
            Serial.print("\t");
            Serial.print(euler[1] * 180/M_PI);
            Serial.print("\t");
            Serial.println(euler[2] * 180/M_PI);
        #endif

        #ifdef OUTPUT_READABLE_YAWPITCHROLL
            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
            Serial.print("ypr\t");
            Serial.print(ypr[0] * 180/M_PI);
            Serial.print("\t");
            Serial.print(ypr[1] * 180/M_PI);
            Serial.print("\t");
            Serial.println(ypr[2] * 180/M_PI);
        #endif

        #ifdef OUTPUT_READABLE_REALACCEL
            // display real acceleration, adjusted to remove gravity
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            Serial.print("areal\t");
            Serial.print(aaReal.x);
            Serial.print("\t");
            Serial.print(aaReal.y);
            Serial.print("\t");
            Serial.println(aaReal.z);
        #endif

        #ifdef OUTPUT_READABLE_WORLDACCEL
            // display initial world-frame acceleration, adjusted to remove gravity
            // and rotated based on known orientation from quaternion
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetAccel(&aa, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
            mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
            Serial.print("aworld\t");
            Serial.print(aaWorld.x);
            Serial.print("\t");
            Serial.print(aaWorld.y);
            Serial.print("\t");
            Serial.println(aaWorld.z);
        #endif

        #ifdef OUTPUT_TEAPOT
            // display quaternion values in InvenSense Teapot demo format:
            teapotPacket[2] = fifoBuffer[0];
            teapotPacket[3] = fifoBuffer[1];
            teapotPacket[4] = fifoBuffer[4];
            teapotPacket[5] = fifoBuffer[5];
            teapotPacket[6] = fifoBuffer[8];
            teapotPacket[7] = fifoBuffer[9];
            teapotPacket[8] = fifoBuffer[12];
            teapotPacket[9] = fifoBuffer[13];
            Serial.write(teapotPacket, 14);
            teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
        #endif

    }

}

What exactly is the problem with your combined code? And please format the code correctly by selecting it and click the {} button in the editors toolbar or press Ctrl+k

I want to read mpu6050 and ultrasonic sensor both. but it this is the error                       Initializing I2C devices...
Testing device connections...
MPU6050 connection successful
Enabling DMP...
u 0

Have you tried to get the ultrasonic Sensor to work alone to be sure, that it works correctly?

yes. it worked. when both sensor test individually it work.

How did you connect a 3.3v sensor to a 5v board?

mpu6050 gy-521 work with 5v

No, it does not. It has no level shifters for sda and scl.

In the function Update_Ultra_Sonic() you do the measurement and save the result in the variable duration. Then you print the variable cm, but you haven't calculated the value for this variable yet. You have to calculate the number of cm from the echos duration and save the result in cm. When you don't do this, the variable stays at zero.


text:
How can I call the constructor of a Class after it called once?
I have a problem with Classes.
I have a bunch of code, that code is uses Adafruit MQTT FONA library. I call the Class for make new Instance and Connect to specified server with this code;
Adafruit_MQTT_FONA mqtt(&fona, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);

When I want to connect to another server, I call this Instance's constructor after it called once. But it don't let me to construct it again. How can I construct the same instance again after it constructed once?
void connectMqtt()
{
    Adafruit_MQTT_FONA mqtt(&fona, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
}

connectMqtt();

Thanks for helps! Have a good day!

note:  your question is not about Arduino .... it is a C++ programming question

You can't. Once constructed, an object remains constructed until you delete it.
You could either use dynamic allocation and new and delete to create and destroy objects at will, or you could create multiple objects with different settings and use different objects at different times.
Another option would be to modify the library to create a new function that accepts and assigns new server settings. All the constructor does is store the settings in variables - there's no reason why you couldn't just change those variables.


text:
How to build an µC controlled power regulator?
The idea: Use an Arduino-like µC to control a set of CPU fans by control the voltage the CPU fans receive. My question: How can I do this in an easy way?
Yes, I know, there is PWM but this is not very suitable for this purpose: I did some tests with it but it turns out that the characteristics of PWM fans don't suite my purpose: PWM fans are designed to be controlled between not audible and full speed, not between nearly not rotating and full speed. Even very special fans with a wide range of PWM speed control don't work as well as powering a regular 12V fan with just 5 or 6V.
Which brings me to an alternative idea: It should be possible to send an I2C or SPI signal to some kind of IC that then provides a voltage as required.
Alternatively to that there seem to be PWM controlled voltage regulators available. But that doesn't seem to be a very elegant solution, isn't it?
Or is there an even better way of controlling the voltage output to the fans I'm not aware of?
I'm aiming for a solution that works well and can be build with little effort. Unfortunately I don't know how to do that: I can't find any breakouts I could use right away for that purpose. Probably there are some and I just have not been able to find them? Any help is appreciated!

It's actually very simple, and it indeed does involve using PWM.
PWM is just a signal being on for a percentage of a predefined period.  That percentage is also, when the PWM signal is averaged out, equivalent to a percentage of the peak voltage of the PWM signal.
So if you take a PWM signal and use it to switch a higher power source (say, through a P-channel MOSFET that's being itself switched by an N-channel MOSFET), then add smoothing to that switched output, and you have a variable voltage.
If you want to know what that voltage is you can add a resistor network to the output (assuming it's higher than the voltage the MCU can handle) and read the divided voltage using an ADC.  You can then use that as a feedback loop to adjust the PWM duty cycle to get your desired voltage.

simulate this circuit – Schematic created using CircuitLab
That is precisely* how switch-mode power supplies work. Use PWM to switch a FET that controls an incoming voltage, then smooth it out, adding a feedback network for control.

*Apart from the PWM bit: they often use other methods of switching the signal to get better efficiency at different loads, such as PFM.


text:
ESP8266-01 wdt reset after uploading code
I'm using code from here: ESP8266 example: Wi-Fi Access point, static IP, web-server and remote GPIO control.
Everything running ok this morning, but now I don't know why wasn't working...
This is what serial monitor display:
Configuring access point...
AP IP address: 42.42.42.42
HTTP server started

Exception (0):
epc1=0x40226744 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys
sp: 3fffed10 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffeeb0:  00000000 3fffdad0 3ffeefec 00000030
3fffeec0:  3ffe9560 40226dbb 3fff0104 0000d158
3fffeed0:  00000000 40216ec8 3ffedfe8 4020f68c
3fffeee0:  00f20e64 3ffe9374 3ffe9204 3ffef190
3fffeef0:  4020f7c8 3ffef194 3ffe91fc 60000600
3fffef00:  40226731 3ffe9370 3ffee820 00000001
3fffef10:  40226814 3ffe9374 3ffee820 0331cfa4
3fffef20:  3fff0104 40100ab6 00000001 00000000
3fffef30:  4022df51 40100883 00000000 00000000
3fffef40:  4022df96 3fffdab0 00000000 3fffdcb0
3fffef50:  3ffee838 3fffdad0 3ffeefec 402073e3
3fffef60:  40000f49 40000f49 3fffdab0 40000f49
3fffef70:  40000e19 40001878 00000004 00000000
3fffef80:  3fffff10 aa55aa55 000000ed 40104424
3fffef90:  4010442a 00000004 00000000 a9751f68
3fffefa0:  4010000d e45c7604 ffd63db0 ca695611
3fffefb0:  00000000 3fffef4c 00000000 3fffff08
3fffefc0:  3fffffd0 00000000 00000000 feefeffe
3fffefd0:  feefeffe feefeffe feefeffe feefeffe
3fffefe0:  feefeffe feefeffe feefeffe feefeffe
3fffeff0:  feefeffe feefeffe feefeffe feefeffe
3ffff000:  feefeffe feefeffe feefeffe feefeffe
3ffff010:  feefeffe feefeffe feefeffe feefeffe
3ffff020:  feefeffe feefeffe feefeffe feefeffe
3ffff030:  feefeffe feefeffe feefeffe feefeffe
3ffff040:  feefeffe feefeffe feefeffe feefeffe
3ffff050:  feefeffe feefeffe feefeffe feefeffe
3ffff060:  feefeffe feefeffe feefeffe feefeffe
3ffff070:  feefeffe feefeffe feefeffe feefeffe
3ffff080:  feefeffe feefeffe feefeffe feefeffe
3ffff090:  feefeffe feefeffe feefeffe feefeffe
3ffff0a0:  feefeffe feefeffe feefeffe feefeffe
3ffff0b0:  feefeffe feefeffe feefeffe feefeffe
3ffff0c0:  feefeffe feefeffe feefeffe feefeffe
3ffff0d0:  feefeffe feefeffe feefeffe feefeffe
3ffff0e0:  feefeffe feefeffe feefeffe feefeffe
3ffff0f0:  feefeffe feefeffe feefeffe feefeffe
3ffff100:  feefeffe feefeffe feefeffe feefeffe
3ffff110:  feefeffe feefeffe feefeffe feefeffe
3ffff120:  feefeffe feefeffe feefeffe feefeffe
3ffff130:  feefeffe feefeffe feefeffe feefeffe
3ffff140:  feefeffe feefeffe feefeffe feefeffe
3ffff150:  feefeffe feefeffe feefeffe feefeffe
3ffff160:  feefeffe feefeffe feefeffe feefeffe
3ffff170:  feefeffe feefeffe feefeffe feefeffe
3ffff180:  feefeffe feefeffe feefeffe feefeffe
3ffff190:  feefeffe feefeffe feefeffe feefeffe
3ffff1a0:  feefeffe feefeffe feefeffe feefeffe
3ffff1b0:  feefeffe feefeffe feefeffe feefeffe
3ffff1c0:  feefeffe feefeffe feefeffe feefeffe
3ffff1d0:  feefeffe feefeffe feefeffe feefeffe
3ffff1e0:  feefeffe feefeffe feefeffe feefeffe
3ffff1f0:  feefeffe feefeffe feefeffe feefeffe
3ffff200:  feefeffe feefeffe feefeffe feefeffe
3ffff210:  feefeffe feefeffe feefeffe feefeffe
3ffff220:  feefeffe feefeffe feefeffe feefeffe
3ffff230:  feefeffe feefeffe feefeffe feefeffe
3ffff240:  feefeffe feefeffe feefeffe feefeffe
3ffff250:  feefeffe feefeffe feefeffe feefeffe
3ffff260:  feefeffe feefeffe feefeffe feefeffe
3ffff270:  feefeffe feefeffe feefeffe feefeffe
3ffff280:  feefeffe feefeffe feefeffe feefeffe
3ffff290:  feefeffe feefeffe feefeffe feefeffe
3ffff2a0:  feefeffe feefeffe feefeffe feefeffe
3ffff2b0:  feefeffe feefeffe feefeffe feefeffe
3ffff2c0:  feefeffe feefeffe feefeffe feefeffe
3ffff2d0:  feefeffe feefeffe feefeffe feefeffe
3ffff2e0:  feefeffe feefeffe feefeffe feefeffe
3ffff2f0:  feefeffe feefeffe feefeffe feefeffe
3ffff300:  feefeffe feefeffe feefeffe feefeffe
3ffff310:  feefeffe feefeffe feefeffe feefeffe
3ffff320:  feefeffe feefeffe feefeffe feefeffe
3ffff330:  feefeffe feefeffe feefeffe feefeffe
3ffff340:  feefeffe feefeffe feefeffe feefeffe
3ffff350:  feefeffe feefeffe feefeffe feefeffe
3ffff360:  feefeffe feefeffe feefeffe feefeffe
3ffff370:  feefeffe feefeffe feefeffe feefeffe
3ffff380:  feefeffe feefeffe feefeffe feefeffe
3ffff390:  feefeffe feefeffe feefeffe feefeffe
3ffff3a0:  feefeffe feefeffe feefeffe feefeffe
3ffff3b0:  feefeffe feefeffe feefeffe feefeffe
3ffff3c0:  feefeffe feefeffe feefeffe feefeffe
3ffff3d0:  feefeffe feefeffe feefeffe feefeffe
3ffff3e0:  feefeffe feefeffe feefeffe feefeffe
3ffff3f0:  feefeffe feefeffe feefeffe feefeffe
3ffff400:  feefeffe feefeffe feefeffe feefeffe
3ffff410:  feefeffe feefeffe feefeffe feefeffe
3ffff420:  feefeffe feefeffe feefeffe feefeffe
3ffff430:  feefeffe feefeffe feefeffe feefeffe
3ffff440:  feefeffe feefeffe feefeffe feefeffe
3ffff450:  feefeffe feefeffe feefeffe feefeffe
3ffff460:  feefeffe feefeffe feefeffe feefeffe
3ffff470:  feefeffe feefeffe feefeffe feefeffe
3ffff480:  feefeffe feefeffe feefeffe feefeffe
3ffff490:  feefeffe feefeffe feefeffe feefeffe
3ffff4a0:  feefeffe feefeffe feefeffe feefeffe
3ffff4b0:  feefeffe feefeffe feefeffe feefeffe
3ffff4c0:  feefeffe feefeffe feefeffe feefeffe
3ffff4d0:  feefeffe feefeffe feefeffe feefeffe
3ffff4e0:  feefeffe feefeffe feefeffe feefeffe
3ffff4f0:  feefeffe feefeffe feefeffe feefeffe
3ffff500:  feefeffe feefeffe feefeffe feefeffe
3ffff510:  feefeffe feefeffe feefeffe feefeffe
3ffff520:  feefeffe feefeffe feefeffe feefeffe
3ffff530:  feefeffe feefeffe feefeffe feefeffe
3ffff540:  feefeffe feefeffe feefeffe feefeffe
3ffff550:  feefeffe feefeffe feefeffe feefeffe
3ffff560:  feefeffe feefeffe feefeffe feefeffe
3ffff570:  feefeffe feefeffe feefeffe feefeffe
3ffff580:  feefeffe feefeffe feefeffe feefeffe
3ffff590:  feefeffe feefeffe feefeffe feefeffe
3ffff5a0:  feefeffe feefeffe feefeffe feefeffe
3ffff5b0:  feefeffe feefeffe feefeffe feefeffe
3ffff5c0:  feefeffe feefeffe feefeffe feefeffe
3ffff5d0:  feefeffe feefeffe feefeffe feefeffe
3ffff5e0:  feefeffe feefeffe feefeffe feefeffe
3ffff5f0:  feefeffe feefeffe feefeffe feefeffe
3ffff600:  feefeffe feefeffe feefeffe feefeffe
3ffff610:  feefeffe feefeffe feefeffe feefeffe
3ffff620:  feefeffe feefeffe feefeffe feefeffe
3ffff630:  feefeffe feefeffe feefeffe feefeffe
3ffff640:  feefeffe feefeffe feefeffe feefeffe
3ffff650:  feefeffe feefeffe feefeffe feefeffe
3ffff660:  feefeffe feefeffe feefeffe feefeffe
3ffff670:  feefeffe feefeffe feefeffe feefeffe
3ffff680:  feefeffe feefeffe feefeffe feefeffe
3ffff690:  feefeffe feefeffe feefeffe feefeffe
3ffff6a0:  feefeffe feefeffe feefeffe feefeffe
3ffff6b0:  feefeffe feefeffe feefeffe feefeffe
3ffff6c0:  feefeffe feefeffe feefeffe feefeffe
3ffff6d0:  feefeffe feefeffe feefeffe feefeffe
3ffff6e0:  feefeffe feefeffe feefeffe feefeffe
3ffff6f0:  feefeffe feefeffe feefeffe feefeffe
3ffff700:  feefeffe feefeffe feefeffe feefeffe
3ffff710:  feefeffe feefeffe feefeffe feefeffe
3ffff720:  feefeffe feefeffe feefeffe feefeffe
3ffff730:  feefeffe feefeffe feefeffe feefeffe
3ffff740:  feefeffe feefeffe feefeffe feefeffe
3ffff750:  feefeffe feefeffe feefeffe feefeffe
3ffff760:  feefeffe feefeffe feefeffe feefeffe
3ffff770:  feefeffe feefeffe feefeffe feefeffe
3ffff780:  feefeffe feefeffe feefeffe feefeffe
3ffff790:  feefeffe feefeffe feefeffe feefeffe
3ffff7a0:  feefeffe feefeffe feefeffe feefeffe
3ffff7b0:  feefeffe feefeffe feefeffe feefeffe
3ffff7c0:  feefeffe feefeffe feefeffe feefeffe
3ffff7d0:  feefeffe feefeffe feefeffe feefeffe
3ffff7e0:  feefeffe feefeffe feefeffe feefeffe
3ffff7f0:  feefeffe feefeffe feefeffe feefeffe
3ffff800:  feefeffe feefeffe feefeffe feefeffe
3ffff810:  feefeffe feefeffe feefeffe feefeffe
3ffff820:  feefeffe feefeffe feefeffe feefeffe
3ffff830:  feefeffe feefeffe feefeffe feefeffe
3ffff840:  feefeffe feefeffe feefeffe feefeffe
3ffff850:  feefeffe feefeffe feefeffe feefeffe
3ffff860:  feefeffe feefeffe feefeffe feefeffe
3ffff870:  feefeffe feefeffe feefeffe feefeffe
3ffff880:  feefeffe feefeffe feefeffe feefeffe
3ffff890:  feefeffe feefeffe feefeffe feefeffe
3ffff8a0:  feefeffe feefeffe feefeffe feefeffe
3ffff8b0:  feefeffe feefeffe feefeffe feefeffe
3ffff8c0:  feefeffe feefeffe feefeffe feefeffe
3ffff8d0:  feefeffe feefeffe feefeffe feefeffe
3ffff8e0:  feefeffe feefeffe feefeffe feefeffe
3ffff8f0:  feefeffe feefeffe feefeffe feefeffe
3ffff900:  feefeffe feefeffe feefeffe feefeffe
3ffff910:  feefeffe feefeffe feefeffe feefeffe
3ffff920:  feefeffe feefeffe feefeffe feefeffe
3ffff930:  feefeffe feefeffe feefeffe feefeffe
3ffff940:  feefeffe feefeffe feefeffe feefeffe
3ffff950:  feefeffe feefeffe feefeffe feefeffe
3ffff960:  feefeffe feefeffe feefeffe feefeffe
3ffff970:  feefeffe feefeffe feefeffe feefeffe
3ffff980:  feefeffe feefeffe feefeffe feefeffe
3ffff990:  feefeffe feefeffe feefeffe feefeffe
3ffff9a0:  feefeffe feefeffe feefeffe feefeffe
3ffff9b0:  feefeffe feefeffe feefeffe feefeffe
3ffff9c0:  feefeffe feefeffe feefeffe feefeffe
3ffff9d0:  feefeffe feefeffe feefeffe feefeffe
3ffff9e0:  feefeffe feefeffe feefeffe feefeffe
3ffff9f0:  feefeffe feefeffe feefeffe feefeffe
3ffffa00:  feefeffe feefeffe feefeffe feefeffe
3ffffa10:  feefeffe feefeffe feefeffe feefeffe
3ffffa20:  feefeffe feefeffe feefeffe feefeffe
3ffffa30:  feefeffe feefeffe feefeffe feefeffe
3ffffa40:  feefeffe feefeffe feefeffe feefeffe
3ffffa50:  feefeffe feefeffe feefeffe feefeffe
3ffffa60:  feefeffe feefeffe feefeffe feefeffe
3ffffa70:  feefeffe feefeffe feefeffe feefeffe
3ffffa80:  feefeffe feefeffe feefeffe feefeffe
3ffffa90:  feefeffe feefeffe feefeffe feefeffe
3ffffaa0:  feefeffe feefeffe feefeffe feefeffe
3ffffab0:  feefeffe feefeffe feefeffe feefeffe
3ffffac0:  feefeffe feefeffe feefeffe feefeffe
3ffffad0:  feefeffe feefeffe feefeffe feefeffe
3ffffae0:  feefeffe feefeffe feefeffe feefeffe
3ffffaf0:  feefeffe feefeffe feefeffe feefeffe
3ffffb00:  feefeffe feefeffe feefeffe feefeffe
3ffffb10:  feefeffe feefeffe feefeffe feefeffe
3ffffb20:  feefeffe feefeffe feefeffe feefeffe
3ffffb30:  feefeffe feefeffe feefeffe feefeffe
3ffffb40:  feefeffe feefeffe feefeffe feefeffe
3ffffb50:  feefeffe feefeffe feefeffe feefeffe
3ffffb60:  feefeffe feefeffe feefeffe feefeffe
3ffffb70:  feefeffe feefeffe feefeffe feefeffe
3ffffb80:  feefeffe feefeffe feefeffe feefeffe
3ffffb90:  feefeffe feefeffe feefeffe feefeffe
3ffffba0:  feefeffe feefeffe feefeffe feefeffe
3ffffbb0:  feefeffe feefeffe feefeffe feefeffe
3ffffbc0:  feefeffe feefeffe feefeffe feefeffe
3ffffbd0:  feefeffe feefeffe feefeffe feefeffe
3ffffbe0:  feefeffe feefeffe feefeffe feefeffe
3ffffbf0:  feefeffe feefeffe feefeffe feefeffe
3ffffc00:  feefeffe feefeffe feefeffe feefeffe
3ffffc10:  feefeffe feefeffe feefeffe feefeffe
3ffffc20:  feefeffe feefeffe feefeffe feefeffe
3ffffc30:  feefeffe feefeffe feefeffe feefeffe
3ffffc40:  feefeffe feefeffe feefeffe feefeffe
3ffffc50:  feefeffe feefeffe feefeffe feefeffe
3ffffc60:  feefeffe feefeffe feefeffe feefeffe
3ffffc70:  feefeffe feefeffe feefeffe feefeffe
3ffffc80:  feefeffe feefeffe feefeffe feefeffe
3ffffc90:  feefeffe feefeffe feefeffe feefeffe
3ffffca0:  feefeffe feefeffe feefeffe feefeffe
3ffffcb0:  feefeffe feefeffe feefeffe feefeffe
3ffffcc0:  feefeffe feefeffe feefeffe feefeffe
3ffffcd0:  feefeffe feefeffe 40227cb3 00000001
3ffffce0:  ffffffff 00000000 3ffe96b1 00000008
3ffffcf0:  40227d02 3ffeccf8 3ffefadc 00000001
3ffffd00:  3fff07e8 00000000 4010106b 3ffeccf8
3ffffd10:  000000c0 4021a0c2 00000008 3fff06d8
3ffffd20:  40226d70 3ffeccf8 3ffed470 3fff07e8
3ffffd30:  00000000 4021a22b 3ffefd84 feefeffe
3ffffd40:  00000000 00000002 00000001 3ffeccf8
3ffffd50:  00000000 400042db 3fff07e8 3ffeff44
3ffffd60:  40004b31 3fff080c 0000049c 0007e000
3ffffd70:  401057e0 4020dfcd 3ffef154 3ffeff44
3ffffd80:  40106475 3fff080c 0000049c 00000000
3ffffd90:  00000000 00000000 00000020 40100f22
3ffffda0:  00000000 00000000 00000020 40100f22
3ffffdb0:  3ffe9560 40104304 3fff0104 40100f22
3ffffdc0:  00000001 40103523 3ffed6e0 40100f22
3ffffdd0:  40103986 00000000 00000020 40100f22
3ffffde0:  4010346a 0000007f 7fffffff 00000000
3ffffdf0:  4010346a 0000007f 7fffffff 00000000
3ffffe00:  0000007f 00040000 7fffffff 00000000
3ffffe10:  40103269 00040000 7fffffff 00000000
3ffffe20:  00000000 00000000 0000001f 40104bfd
3ffffe30:  00000000 00000000 0000001f 40104bfd
3ffffe40:  4000050c 00000030 00000011 ffffffff
3ffffe50:  00000000 00000000 0000001f 40104bfd
3ffffe60:  4000050c 00000002 03316038 00000000
3ffffe70:  4020386b 00000030 00000010 ffffffff
3ffffe80:  00000000 00000000 0000001f 40104bfd
3ffffe90:  4000050c 00000000 00000000 fffffffe
3ffffea0:  40000ea6 00000030 0000001e ffffffff
3ffffeb0:  40000ea3 00000000 00000001 00000001
3ffffec0:  3fffdab0 00000000 3fffd9d0 3ffeefec
3ffffed0:  00000000 00000000 00000001 3ffeefe4
3ffffee0:  00000000 3fffdad0 3ffeefec 00000030
3ffffef0:  ffffffff 3fffc6fc 00000001 3ffe85e8
3fffff00:  00000000 3fffdad0 3ffeefec 00000030
3fffff10:  00000000 3fffdad0 3ffeefec 00000030
3fffff20:  402077a4 3ffeedfc 000003e8 402074e2
3fffff30:  3ffe8f00 00000000 00000000 40207525
3fffff40:  3ffe8cac 3ffeedfc 3ffeee00 40203fbe
3fffff50:  3fff014c 00ffffff 3ffeef2c 4020671c
3fffff60:  3fffdad0 3ffeedfc 3ffeedfc 40207918
3fffff70:  4020290c 00000000 3ffeedfc 40204f31
3fffff80:  40207b28 00000000 00001388 40207c40
3fffff90:  00000000 00000000 feefeffe feefeffe
3fffffa0:  00000000 00000000 00000001 40207449
<<<stack<<<

 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset

 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset

Could someone please tell me how can I make it work again?

If reflashing the code doesn't fix it, then it could be a hardware fault. Try another unit.

I tried the sketch you posted and it works.
The most likely problem is the power source for the ESP8266. You have in the title ESP8266-1 so I will assume you have a ESP-01 module.
A lot of people who start with the ESP-01, or any other module without an onboard 3.3v regulator, don't know how demanding the ESP8266 is on the power source. It needs to have a stable 500mA capacity for it to work reliably. Also the regulator must be electrically close to the module. Using long connecting wires is one problem I see often.
The ESP8266 could have enough power to get programmed correctly but when it comes to transmitting it will draw a lot more current and if the power supply is insufficient a voltage dip occurs and then unpredictable behaviour occurs.
Check over any connections that might be poor. Please post what you are using for hardware if you can't get things running again.

note that AP mode uses more power than STA because sleep is disabled by default...


text:
How to make Built in LED blink systematically?
I am trying to make my built in LED on my arduino blink every 1 second while recording my data and putting it in the EEPROM, but I am not sure how to do that. I am supposed to print data to the EEPROM every minute, until the EEPROM is full and while that is going on my built in LED should blink for approx 1 second. My problem seems to be that I am setting a delay to delay how long the data is stored on the EEPROM, but it is also affecting the time it takes for my LED to blink as it is waiting to blink as the data is stored. Any help would be appreciated, the code is below:
#include<EEPROM.h>
const int SWITCH = 4;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(SWITCH, INPUT_PULLUP);

}

void loop() {
  // put your main code here, to run repeatedly:
  int addr = 0;
  int r = analogRead(0);

  if (digitalRead(SWITCH) == LOW) {
    Serial.println("----Recording----");
  }
  while (addr <= 1024) {
    digitalWrite(LED_BUILTIN, HIGH);
    delay (250);
    digitalWrite(LED_BUILTIN, LOW);
    delay(750);
    Serial.println(r);
    EEPROM.put(addr, r);
    addr = addr + 2;
    delay(600);
  }
  while (true);
}

If you add up all your delays you get 1600ms. Removing the last delay(600); would make the duration of you loop a lot closer to 1 second. Indeed the other code would take a bit of time to, but my guess would be that it only takes 5ms per cycle. Depending on you application, that might be good enough. It might also be the case that you need it so precise that the precision of the crystal the Arduino uses isn't good enough.

Do not use delay(). Use the example Blink without delay example as the starting point.
https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
Find it under Examples    02.Digital
Simple code like delay() is called blocking code. It prevents other things from happening until t is through. That is acceptable in very sequential linear programs where only one thing is ever happening. And you have discovered the limitation of that. Time to get more sophisticated in your programming.
Please open the example and play with it. Make sure you understand it before thinking of how to modify your code.

Would you be able to clean up my code to do this? I'm not sure how I am supposed to go about doing what you said

I added more to the answer. Open the example and learn what it does. Don't think about your program yet. You need to learn this kind of thing and not just copy someone's code.

As Rudy mentions in his answer, don't use delay(), and start with the BlinkWithoutDelay example that comes with the Arduino IDE. Here is a sketch to get you started. If you compare it to the BlinkWithoutDelay example, it's very similar, except I added some button code to "start" and "stop" the LED flashing.
const byte SWITCH = 4;
const byte ledPin = 13;
const unsigned long oneSecond = 1000;
unsigned long previousMillis = 0;
byte ledState = LOW;
byte recording = 0;

void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(SWITCH, INPUT_PULLUP);
}

void loop(){

  unsigned long currentMillis = millis();

  if(digitalRead(SWITCH) == LOW){
    recording = 1;
  }
  else{
    recording = 0;
    digitalWrite(ledPin, LOW);
  }

  if(currentMillis - previousMillis >= oneSecond){

    previousMillis = currentMillis;

    if(recording){
      if(ledState == LOW){
        ledState = HIGH;
      }
      else{
        ledState = LOW;
      }
    }
    digitalWrite(ledPin, ledState);
  }
}

I didn't post modified code because I want him to understand what is happening in the example without proceeding with his program. I feel it is more important to learn than to just get an answer.

I agree with you Rudy. As I mentioned in my answer, this sketch is almost identical to the BlinkWithoutDelay example, with the addition of the "button code" that Thomas already wrote. I just wanted Thomas to start heading in the right direction. Thomas still has to figure out how to add a "minute" timer to the sketch, get the analog reading and store it in EEPROM. That will keep him busy for a while :)


text:
Stacks on arrays on arrays
I am trying to find a "vanilla" way of writing several arrays into one. I spent a lot of time searching for how to do this but everything that comes up is either a tutorial that doesn't cover concatenation or someones question that ended up being an unrelated syntax problem.
I put several strands of WS2812B LEDs wired in series so the Arduino sees them as one continuous strand. I have been able to run some very cool patterns as one strand using the Pololu library but I would like to program the strands separately. The number of lights I have is very resource intensive and I like to keep things simple so I'm looking for advice on the best way to go about combining arrays without importing more libraries.
Because the patterns I have used so far write to an array and the output is an array, my first thought was that I could write one pattern to an array made up of sections 1, 4, and 5, and another pattern that would be mapped to sections 2, 3, and 6 and then concatenate it all together in order. However, adding arrays seems to be somewhat complicated without worrying about this or that persons favorite library or looping through one value at a time and I am trying to work on my C skills. Is there a simple way to concatenate arrays or a better way for me to think about this? Any best practice or organizational advice is welcome. I want to write clean code.
Bonus Round: I use several different languages at work and I cant figure out why I have it in my head that this would work...
array1 = [a, b, c]
array2 = [x, y]
array3 = array1 + array2

// array3 = [a, b, c, x, y]

Any idea if that is possible or what language I am thinking of?

A 2 dimensional array is technically saved serialized as a long 1 dimensional array. It should be possible to read/write each subarray and also the whole array with 1 dimension using pointer. Maybe I have time to write a whole answer to this later this day.

C(++) does not natively let you "add" arrays like that.  Your code looks like maybe Python.
There are several ways to do what you want to do.  You could make your code which writes the pattern to the array accept an offset - so rather than always starting at position 0, you could tell it where to start.
You could write a function to "concatenate" arrays, or use one someone else has written, if you can find one.  It's pretty trivial to do.
However the method I'd use in your situation, probably just a matter of preference really, is this:
Let's say (for example) you have 6 strips of 10 LEDs each.  You need 60 elements to represent them all.  (I'm assuming each element is an int; I can't remember if it is.)  Create one big array for the whole lot:
int allElements[60];

You might think of the variable allElements as an array, but it is really an int* (a pointer to an int), with that memory address happening to have 59 other memory addresses after it reserved.  C knows that when you say allElements[7] it needs to looks 7 ints on from the address pointed to by allElements.  What this means is that you can create new variables which point to parts of that array, and use those variables as if they were their own arrays.  For example:
int *firstStrip = &(allElements[0]);
int *secondStrip = &(allElements[10]);
int *thirdStrip = &(allElements[20]);
/* ... and so on */

(There is a more idiomatic way to write this which is exactly equivalent, but I think the above is more explicit if you're new to it.)
As an extra improvement you might now notice that you have a load of similarly-named variables with similar functions -- and you might want to put them into an array.
int* strips[] = { &(allElements[0]), &(allElements[1]), &(allElements[2]) /* and so on */};

Now you can use strips[3] to give you the fourth strip.
There are several other ways too, but I think this will get you going.


text:
Does NodeMCU have some protection against wrong connections that could kill a computer USB?
I know some computer USB could handle some bad connection (by blocking the port, which need to reboot the computer). But I wonder if a NodeMCU 8266 offers some protection.

Most USB ports are shut down when an over-current event is detected.
There is nothing in a NodeMCU that can prevent an over-current event in the case of things like short circuits. The 5V (or VIN on some versions) pin is directly (or sometimes via a single diode) connected to the 5V pin of the USB. Cause a short on the 5V pin and you cause a short on the USB.
Protection is designed to be at the port level not the device level so that devices don't have to be forced to comply to protection "standards" that would drive up costs and result in devices being non-compliant and risk damaging the computer.
If you find that you are often causing shorts on the 5V pin and killing (albeit temporarily) your USB ports you should change your working practices.
It can be good to always connect your devices to an external powered USB hub instead of directly to your computer. That way if you kill a port you can just unplug the hub and plug it back in again to reset all the ports. No need to reboot your computer.
Cheap hubs often just have a simple PTC fuse instead of proper over-current protection which can actually be more useful for device developers since the port won't be disabled, just the external power shut off.
Most Arduino boards do incorporate a PTC fuse in the USB power circuitry, but NodeMCU and similar boards don't.

Thanks! But instead of USB hub, shouldn't it instead be an "USB insulator?" such as this one https://www.ebay.com/itm/1500V-USB-to-USB-Isolator-Board-Protection-Isolation-ADUM4160-ADUM3160-Module/152382773951?hash=item237ab89abf:g:2d8AAOSwEzxYbQMG

You could use an isolator, but a hub is just as good in this situation and a whole lot more useful.

Would even the cheapest hub do it? (Not sure of the grammar of this one!)


text:
ESP8266 library: 2 requests received instead of 1
I have a strange issue with my sketch using WiFiEsp.h library from https://github.com/bportaluri/WiFiEsp
When i send 1 request to my ESP8266 from my browser as http://192.168.0.25
, it seems that my ESP8266 receives 2 requests and run 2 times. See the sketch here and Serial Termninal:
void loop()
{
  // listen for incoming clients
  WiFiEspClient client = server.available();
  if (client) {
    Serial.println("New client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          Serial.println("Sending response");

          // send a standard http response header
          // use \r\n instead of many println statements to speedup data send
          client.print(
            "HTTP/1.1 200 OK\r\n"
            "Content-Type: text/html\r\n"
            "Connection: close\r\n"  // the connection will be closed after completion of the response
            "\r\n");
          client.print("<!DOCTYPE HTML>\r\n");
          client.print("\r\n");
          client.print("Hello World!\r\n");
          client.print("\r\n");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(10);

    // close the connection:
    client.stop();
    Serial.println("Client disconnected");
  }
}

Serial temrinal:
[WiFiEsp] Initializing ESP module
[WiFiEsp] Initilization successful - 2.0.0
Attempting to connect to WPA SSID: Numericable-6010
[WiFiEsp] Connected to Numericable-6010
You're connected to the network
SSID: Numericable-6010
IP Address: 192.168.0.25

To see this page in action, open a browser to http://192.168.0.25

[WiFiEsp] Server started on port 80
[WiFiEsp] New client 0
New client
GET / HTTP/1.1
Host: 192.168.0.25
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://192.168.0.25/
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7

Sending response
[WiFiEsp] Disconnecting  0
Client disconnected
[WiFiEsp] New client 1
New client
GET /favicon.ico HTTP/1.1
Host: 192.168.0.25
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Referer: http://192.168.0.25/
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7

Sending response
[WiFiEsp] Disconnecting  1
Client disconnected

Please, could you explain why 2 clients connected ? How can i disconnect just after the first one ?

browsers automaticaly request /favicon.ico for sites

https://stackoverflow.com/questions/1321878/how-to-prevent-favicon-ico-requests

Thanks for information, but how should i code my url request ?

Could you explain the 'href' parameters ?

instead of pointing to a server, the icon is encoded in the href parameter as base64 string

Browsers automaticaly request /favicon.ico for sites. Add this to  section of your HTML to eliminate the 'favicon' request:
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
client.println("HTTP/1.1 200 OK\r\n" "Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("");
client.println("<link rel='icon' href='data:;base64,iVBORw0KGgo='>");
client.println("");
client.println("Hello World!");
client.println("");

based on this SO answer, instead of pointing to a server, the icon is encoded in the href parameter as base64 string

I changed the <link> to the last edit of the SO answer

Adding head part with hortcut icon link in html response fix the issue. Thanks !!!
            client.print(
            "HTTP/1.1 200 OK\r\n"
            "Content-Type: text/html\r\n"
            "Connection: close\r\n"  // the connection will be closed after completion of the response
            "\r\n");
          client.print("<!DOCTYPE HTML>\r\n");
          client.print("\r\n");
          client.print("<link rel='shortcut icon' href='data:image/x-icon;,' type='image/x-icon'> \r\n");
          client.print("\r\n");
          client.print("\r\n");
          client.print("Hello World!\r\n");
          client.print("\r\n");


text:
32u4 using internal clock on custom PCB - loading sketch
I have a custom PCB with a 32u4 running fine with an 8MHz external oscillator.  I burned the bootloader and loaded my sketch with an UNO using Arduino as ISP.
I have no USB on my PCB nor do I need precise timing, so I wanted to see if I could simplify things by removing the external oscillator and caps.
Reading the 32u4 datasheet it states "The device is shipped with Low Power Crystal Oscillator (8.0 - 16MHz) enabled and with the fuse CKDIV8 programmed".
With that, can I simply hook my PCB (assuming a factory fresh 32u4) via ISP to the UNO as before and in IDE just use Sketch > Upload Using Programmer?    Basically not burning any bootloader at all.
Also, in IDE I have been choosing the Sparkfun ProMicro 3.3v, 8MHz board.  Can I still use that selection?

Yes you can reprogram your 32U4 chips via the ISP, they do not have to be fresh chip. If you set your Fuses to -U lfuse:w:0xE2:m -U hfuse:w:0xD8:m -U efuse:w:0xCB:m using AVRDUDE you will have an 8mhz internal RC oscillator set and you do not have to have the external crystal.
You can play with these settings at http://www.engbedded.com/fusecalc/.
I recommend learning the command line AVRDUDE commands this way you have more control over what you are doing to your chip.
I use this all the time, and if you need to do more than one quickly I typically make a batch file that does the Fuse Burn and hex at the same time.
this is for a attiny167 but you get the idea:
.\avrdude\avrdude -C".\avrdude\avrdude.conf" -v -pattiny167 -cstk500v2 -PCOM3 -Ulfuse:w:0xE2:m -Uhfuse:w:0xDF:m -Uefuse:w:0xFF:m  -Uflash:w:1060X01-001.hex:i

I understand that I can set the fuses using AVRDUDE.  My question is: since the datasheet says the 32u4 comes from the factory with the internal oscillator fuse already set, do I need to do anything additional (i.e. set other fuses) before being able to upload my code with SPI?

I have always programmed my fuses then loaded the bootloader hex. then you can use the USB like any pro micro.

@da40flyer also, the single fuse setting of the High, Low, and Extended fuses are all the fuses you have to set, It configures the entire chip with things that need to be done at power on. After that the only thing you need is your program code or your bootloader on the chip.

have you ever tried setting the fuses with Avrdude on a factory fresh chip?  I could not get the chip to be recognized by avrdude.  I ended up having to put an external clock on the XTAL1 pin in order for avrdude to recognize it... and then I could set the fuses.  Thoughts on this?

I believe I discovered why....  I purchased the 32u4 chips.  While you can set the fuses for the internal clock to be used, it does require an external clock in order to program the first time.  I need to use the 32u4rc which is set from the factory to use the internal clock and can be programmed directly.

actually it doesn't require an external clock you have to tell AVRdude to use a very slow clock like 1024 because without any setting the chip defaults to the 32khz RC clock.

I just received some 32u4RC chips and confirmed:
If you are building a custom PC and want to use the 32u4 chip and use the chip's internal clock for your project, simply purchase the 32u4RC version of the chip.  Your sketch can be loaded onto the chip via SPI without the need to set any fuses with avrdude.


text:
How to allow cross-domain requests on ESP8266WebServer
I am using a Raspberry Pi running Chrome (handling the user interface) and connecting via ajax to an Arduino D1 compatible using the IP address as follows:
    $.ajax({
        type: "GET",
        url: "http://10.1.1.100/myfunc?id=5",
        error:  function(jqXHR, exception, response) {
                console.log(exception, response);

        etc...

I recently started getting this error (wonder why it didn't happen for the last two years):
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://10.1.1.100/myfunc?n=1. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

I tried various things including setting the browser (Chrome) to --disable-web-security and various suggestions, here and here (and many more) but I can't seem to get it to work. Currently, I have:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
ESP8266WebServer server(80);

void handleRoot() {
  server.send(200, "text/plain", "Root of WebServer!");
}

void setup() {
IPAddress ip(10.1.1.100);
IPAddress gateway(10.1.1.1);
IPAddress subnet(...);
WiFi.begin(ssid, password);
WiFi.config(ip, gateway, subnet);
  // put your setup code here, to run once:
  WiFi.begin(ssid, password);
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }

  server.on("/", handleRoot);

  server.on("/myfunc", [](){
    String message = "";
    message += "URI: ";
    message += server.uri();
    message += "\nMethod: ";
    message += (server.method() == HTTP_GET)?"GET":"POST";
    message += "\nArguments: ";
    message += server.args();
    message += "\n";
    for (uint8_t i=0; i<server.args(); i++){
      message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
    }
      String num = server.arg(0);

    server.send(200, "text/plain", message);
 });
  server.on("/myfunc", HTTP_OPTIONS, []() {
    server.sendHeader("Access-Control-Allow-Origin","*")
    server.send(204);
 });

  server.onNotFound(handleNotFound);
  server.begin();
}

void loop() {
  delay(1000);
  ...
  server.handleClient();
}

void handleNotFound(){
  String message = "Error!";
  server.send(404, "text/plain", message);
}

So what am I doing wrong? Also, one complication that might crop up later is that the domain from where I am calling this in ajax is https and from what I understand https and http are not compatible with cross-domain requests.
Any help is appreciated!

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Thanx @Majenko but that is too general and doesn't address the esp8266 scenario.

Does the page that is doing the Ajax request have the CORS headers?

add the CORS header to every response, not only for 'preflight' OPTIONS request. @Majenko, only resources ncluded from other server need CORS headers

you don't need the OPTIONS support, just add the ACAO header to the response

@Juraj and @ dandavis I combined both your comments and it now works!  I removed the OPTIONS part and put server.sendHeader("Access-Control-Allow-Origin","*"); in the response.  Thanx!  If either want to put it in the form of an answer I will be happy to accept it.

@dandavis - notifying you separately because SE only allows one user to be notified per comment

Add the CORS header to every response, not only for 'preflight' OPTIONS request. The OPTIONS support is optional, but the response returning the 'shared resource' must contain the CORS header
"Access-Control-Allow-Origin: *"
EDIT: since 2020, the library has server.enableCORS(true);

just add this line before every response:
server.sendHeader("Access-Control-Allow-Origin", "*");

server.enableCORS(true);

The server will add the response Access-Control-Allow-Origin=* header

enableCORS was added in 2020


text:
Arduino IDE Board Selection for 32u4 on custom PCB
I am using a 32u4 on a custom PCB: 3.3v, 8MHz.
Are there any operational differences between using the Sparkfun ProMicro selection versus the Adafruit ItsyBitsy selection in IDE, since they are both for the 32u4?

Are they both 3.3V, 8 MHz? Or are they 5V, 16 MHz?  Are you trying to select one to bootload your part with?

Yes, both 3.3v, 8MHz.  I have already bootloaded my PCB using the ProMicro selection and it works fine.  I am simply wondering if there is any difference in how the 32u4 would operate if I were to use the ItsyBitsy selection in IDE instead.

There should not be any difference, However you would need to load the ItsyBitsy bootloader instead of the ProMicro Bootloader. Personally, I use the Pro Micro Bootloader on my 32u4 Boards.
The only difference would be in the size of each bootloader, one may be smaller and give you more actual codespace. Other than that there should be no performance difference because your code runs independently of the bootloader.


text:
Getting individual outputs from 4 load cells
This is my first time using an Arduino, and I want to connect 4 load cells to one Arduino board and then get 4 separate outputs for each load cell on a computer.
What would I need to accomplish this and how would I set it up?
Can all four load cells connect to a single Arduino?
Also, could I get it to work with these load cells in particular:
https://www.amazon.co.uk/HALJIA-Weighing-Resistance-Half-bridge-Original-Silver/dp/B0792WCGJC/
or would I have to use ones with a 4 wire output?

connect each load cell to a separate analog input .... number of analog inputs depends on the Arduino board that you have, but it is most likely six analog inputs.

Sparkfun also sells the same load cells, and has a lot of good information regarding their use: https://learn.sparkfun.com/tutorials/getting-started-with-load-cells

For this purpose there are 'simple' interface boards like the HX711 (google on HX711). A guy named Bogde has written an Arduino library to manage this board which you can find on GitHub (https://github.com/bogde/HX711). There you can also subscribe to the corresponding email group, which is rather lively and also handles similar questions as yours.
Also Sparkfun sells these sort of interface boards and has very good and extensive documentation and tutorials on the site (see comment from VE7JRO below your question).
You can manage 4 load cells with one Arduino depending on the frequency with which you want to read them. If all 4 load cells are used to weigh one platform then Sparkfun sells an interface board to combine them in one "weight sensor" making it even more simple to interface with the Arduino.

And would I be able to connect four HX711 boards to a single Arduino at once?

Yes, each HX711 board requires connection with only 2 pins of the Arduino. I advise you to read the information at the site of Sparkfun.


text:
Digispark don't work when I power it by 5v and GND inputs and chip starts heating
I'm beginner so probably I did something stupid, but now my digispark don't work when I power it by 5v and GND inputs but chip starts heating immediately. When I power it by USB everything works well. Did i broke it? And how can I check it?

Did you connect it backwards?

Thanks! Actually, I connect backwards my power supply to dashboard. Now it works fine.

You connected the power backwards - so all the current is being shunted straight through the ESD protection diodes (and likely other routes too) generating lots of heat and risking permanent damage to the MCU.
Take better care next time...


text:
FreeRTOS Timer Use
I use Timer1 on an UNO to generate a 38KHZ signal for IR communications. It all works as expected.
BUT, I need to convert the code to run as a task under FreeRTOS, and can't seem to find any details about which HW timers are available for the UNO or MEGA.
Also, as long as I'm asking about FreeRTOS, is it reliable for the timer tick to be changed from the 15ms that I think is standard to something faster?

FYI, I found my own answer by looking into the FreeRTOS source code.
FreeRTOS uses timer0, timer1, timer2 and timer3 according to the source code. I assume that it uses the timers as required based on CPU type and capability.


text:
Arduino Power Consumption
I am pairing an Arduino Uno along with both a HC-05 bluetooth module and a sensor circuit.
Show below is the circuit conditions as well as the circuit.

As far as powering up the system, I am planning to use a 9 Volt battery(550 ampere) to connect to the Arduino which draws in 45 mA and the sensor circuit which takes in a total of 28 mA. I calculated the total life of one of the batteries to be 7.53 hours by (550/(28+45)). Can someone help me with the total power consumed by the system?
UPDATE:
I read on the sensor data sheet that there are two parameters which heater power as well as sensor consumption. Heater Power consumers approximately 140 mW and the sensor consumes approximately 10 mW. I believe the Arduino will consume 405 mW because of (9 volts * 45 mA)  and the bluetooth module will consume 26.5 mW because (3.3 volts * 8). Therefore, the total power consumption is 571.5 mW. Is this correct??? Also will the 9 volt battery be able to support the total power?

550 ampere - What does it mean? Short circut current? Must be some kind of car battery

Your calculations are not totally right. I did not check the data you provided, so I'm just using the numbers you put.
The arduino draws up 45mA @5V.
The sensor has a power of 150 mW and is powered at 5V, which means a current of 30mA.
The bluetooth module gets 8mA (are you really sure? it seems too low) @3.3V.
Now, the battery gives you 9V. So you need to convert them to the proper (5V and 3.3V) voltages required by the devices.
You have mainly two options:

you use a linear regulator
you use a switching regulator

(Please note that if you use the regulators already present on the UNO board - the 1117 and the LP2985 - you will use the first approach)
In the linear case, the regulator will drop the voltage by dissipating the excess power through heat. In this case, you will need to sum the currents:
Total current = 45mA + 30mA + 8mA = 83mA. Please note that if using a 9V battery, the 5V regulator will need to dissipate (9-5) * 83mA = 332mW of power (or slightly less if the 3.3V regulator directly interfaces to the 9V battery).
Now, according to the first datasheet I stumbled upon on google, this kind of battery have a capacity rated at 10mA, but at 100mA it loses about 40% of it. In fact, batteries tend to last less when the current increases (if you double the current you will get less than half of the time).
Considering so a mere 30% of loss at 83mA, your battery will last slightly above 4 hours and a half (550mAh*70%/83mA)
Now, if you use a switching regulator to get 5V from the 9V (and then a linear one to get the 3.3V), you will have to generate 83mA at 5V. This means that, considering an efficiency of 85%, your battery will have to provide roughly 54mA (83mA*5V/9V/85%).
According to the datasheet of the battery, this lower current reduces the degradation of the capacity to about 25%. The total uptime is consequently 7 hours and a half (550mAh*75%/54mA).
If you put a second switching regulator to get the 3.3V, you will have
- 75mA at 5V, which with a 85% efficiency will become 49mA
- 8mA at 3.3V, and with a lower efficiency due to the very low current (let's say 75%) become 4.4mA
Total current from battery: 53.4mA (which can be considered equal to the case with just one switching converter.
Just one last note: please consider that a heated sensor like the one you have is not engineered for battery-powered devices, since a lot of power becomes heat. When you want to develop a real battery-powered sensor, you will need to go with a lower-power solution for both the microcontroller (and the board) and the sensor


text:
Feed values to an array using keypad interfaced with Arduino Uno
I am trying to input keypad values to an array. The code compiles without any error. When running the code, the code proceeds into the for loop and prints 'm' on the lcd, but doesn't execute "customKey = customKeypad.getKey();" and the below steps and keeps printing 'm' 5 times. I am not able to enter keypad values. Please help.
#include <LiquidCrystal.h>
#include <Keypad.h>

const int rs = A1, en = A0, d4 = A2, d5 = A3, d6 = A4, d7 = A5;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const byte ROWS = 4;
const byte COLS = 4;

char hexaKeys[ROWS][COLS] = { { '1', '2', '3', 'A' }, { '4', '5', '6', 'B' }, {
    '7', '8', '9', 'C' }, { '*', '0', '#', 'D' } };

byte rowPins[ROWS] = { 13, 12, 11, 10 };
byte colPins[COLS] = { 9, 8, 7, 6 };

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS,
    COLS);

//String inputString = "";
char customKey;
char a[5];

void setup() {
  Serial.begin(9600);
  //inputString.reserve(200);
  lcd.begin(16, 2);
}

void loop() {
  lcd.clear();
  if (Serial.read() == '1') {
    lcd.setCursor(0, 0);
    lcd.print("WELCOME !");
    delay(1000);
    lcd.clear();
    lcd.print("Enter UserID :");
    lcd.setCursor(0, 1);
    for (int i = 0; i < 5; i++) {
      lcd.print('m');
      customKey = customKeypad.getKey();
      delay(30);

      if (customKey) {
        lcd.print('*');
        a[i] = customKey;
      }
      if (i == 5) {
        a[i] = '\0';
        break;
      }

      delay(1000);
    }
  }
}

customKeypad.getKey(); doesn't wait for the key press. it returns 0 if no key is pressed.
you should rewrite the sketch to a version where the loop() can loop and key presses are read as they are pressed.

Is there no other way ? I am checking Serial.read()=='1' because I need to get '1' serial output from a zigbee connected to the Arduino to proceed to used id.

You do not have to rewrite the sketch, but you should. It is definitely better to write non-blocking code, because then you can add other functionalities, which seem to happen simultaneously. When you really don't want to, just put the getKey() command inside a while(customKey == 0) statement. It will block the program, until a key is pressed.

the rewrite requires a use of state variable. it can then include the 'idle' state before '1' was received over Serial


text:
LED strip with 12v power connected to ESP32
I'm looking at controlling a ws2811 strip and I have seen mention that you should share the same ground between the strip and the controller, which does make sense.
I do not currently have a proper power supply that will supply the full range of 12,5 and 3 volts but what I do have is one of these breadboard power supplies:
https://tinkersphere.com/906-thickbox_default/breadboard-power-supply-module-33v-5v-arduino-raspberry-pi-compatible.jpg
If using a correctly rated 12v power supply into this am I able to take a feed from the 12v line and hook the strip up to that and still have the rest function correctly?
Thanks!

AFAIK the majority of ws2811 strips are powered at 5V; if you have a 12V one this may work, provided that you give the strip enough current (consider 60mA for each LED at 5V, or 60mA for three LEDs if you have the 12V version with 3 LEDs per strip segment)

Its definitely a 12v one (I have measured it to make sure it was not just mislabelled), which caught me off guard given what I had read, it may be because it is a slightly longer strip at 5m. I will work out the draw as you have suggested to make sure. Thank you very much for your answer, exactly what I needed to know!

I have also seen some (older?) strip where there was a WS2811 chip powered at 12V controlling three RGB leds (all the three leds will have the same color); maybe this is yours... like this rigid pcb strip

You are correct, that looks spot on. 3 LED's per chip. This is the strip I have, they were on a dirt cheap offer.  https://www.amazon.co.uk/DreamColor-MINGER-Waterproof-Flexible-Lighting/dp/B0799B8QN7/ref=sr_1_3?ie=UTF8&qid=1543933680&sr=8-3&keywords=dreamcolor

Looking at the picture, you can cut them three at a time, so I think they are the same as the pcb strip I linked (only those ones had wires, while yours is continuous). I think you will see that you will be able to individually address only three leds at a time, rather than each led independently. In any case, if you want to use an arduino you don't need that module; just attach the 12V to the strip, and then power the arduino through the VIN pin (NOT the 5V pin, use the barrel connector or the Vin pin) and, of course, the ground

@frarugi87 he isn't using an Arduino but an EPS32. Depending on which board, it may not have a VIN pin.

12v->3.3v on an LDO driving an ESP32 will get quite hot, maybe hot enough to shut down the 1117-3.3.  Even on the TO-220 version, I need an inch or two of heatsink to keep them under burning hot to the human touch. I would get a cheap adjustable buck converter or a bigger package LDO

Thank you all for your input, ill take it all onboard. I powered the ESP32 from the 5v pin and I managed to get it working last night for a while before the power supply popped and started passing 9v down the 5v output. @dandavis Do these chips also tend to have problems when running 12v to 5v as well or is it just the 3.3v? Either way, I have ordered some new of these cheap supplies as well as a 12v to 5v buck converter. Thank you all for the guidance!

12v to 5v will generate almost as much heat as 12v to 3.3v, so probably.