texts: Waking up async the Arduino while it's sleeping periodically

texts:
I´m using LowPower.h and PinChangeInt.h libraries to put my Arduino into the sleep mode every 8 seconds and then it wakes up, modifies a counter and it goes to sleep again, but also I need to wake it up when a button is pressed asynchronously.

I´ve reached to wake up the Arduino every 8 seconds using LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF) and, in other code, I´ve also reached to wake it up while it sleeps indefinitely with LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF) but I can´t combine that periodical awakening with the asynchronous awakening.

Here is my code:

void setup(){

    Serial.begin(9600);

    //Pines declaration

    loopsToSend = setTimeToSend();  //

    //The three async buttons
    PCintPort::attachInterrupt(4, readOpinion,RISING);
    PCintPort::attachInterrupt(5, readOpinion,RISING);
    PCintPort::attachInterrupt(6, readOpinion,RISING);
}

void loop(){

    if(loops < loopsToSend ){

        byte opinionValue = readOpinion(); //This method must awake the Arduino ASYNC to give a value to the opinionValue var, write the result in the file and go to sleep

        if(opinionValue != 0){
            Serial.println("Button pressed!");

            //Writing result in a file
            opiniones++;
            delay(500);
        }
        //Go to sleep 8 seconds
        LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
        opinionValue = 0;
    }
    else {
        wdt_disable();

        if(opiniones > 0){
            //Send file using GSM module
        }
        else{
            loops = 0;
        }
    }
    loops++;
}

Can anyone help me? Thanks


texts: LCD Weather Station - "Press To Start" Function

texts:
I've been trying to make a weather station using a I2C LCD Display and a DHT11, I know, the DHT11 is a bit low res and all that, but it came with the kit I ordered, so it's okay.

However, I'm trying to have it display like a "title" screen, and after a 2sec delay it should proceed to say "Welcome!" and "Press to Start", and wait there until the button is pressed, and after the button is pressed it should proceed to show the temp and humidity.

However it doesn't seem to mind any of the functions added, unless I set the "if" statement at the beginning of the loop to "LOW", then for some reason, the program stops at "Welcome!" and "press to start".
If I change the "if" statement condition to "HIGH" it just proceeds straight through to the temp and humidity.

#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//CONSTANTS
#define DHTPIN 3
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

LiquidCrystal_I2C lcd(0x27, 16, 2);

//Variables
int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

const int buttonPin = 6;

int buttonState = 1;

void setup()
{
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
  dht.begin();
  lcd.begin();
  lcd.clear();
  delay(1000);
  lcd.setCursor(0, 0);
  lcd.print("WeatherMate");
  lcd.setCursor(0, 1);
  delay(250);
  lcd.print("Press 'Start'");
  delay(1000);;
  if (buttonState = 0)
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Welcome!");
    lcd.setCursor(0, 1);
    lcd.print("Press Start");
  }
}

void loop() {
  buttonState = digitalRead(buttonPin);
  if (buttonState = 1) {
  delay(500);

  hum = dht.readHumidity();
  temp = dht.readTemperature();
  if (temp <= 25) {
    digitalWrite(13, LOW);
    digitalWrite(12, HIGH);
  }
  if (temp >= 25) {
    digitalWrite(13, HIGH);
    digitalWrite(12, LOW);
  }
  Serial.print("Humidity: ");
  Serial.print(hum);
  Serial.print(" %, Temp: ");
  Serial.print(temp);
  Serial.println(" Celsius");

  lcd.setCursor(0,0);
  lcd.print("Temp: ");
  lcd.print(temp);
  lcd.print(" ");
  lcd.print("C");
  lcd.setCursor(0,1);
  lcd.print("Hum:  ");
  lcd.print(hum);
  lcd.print(" %");

  delay(500); //Delay 2 sec.

}
}

Anyone? I'm stuck on this one.


texts:
I have an LDR/Photocell which sends a value 1 or 0 (depending on the value) to a text file on my web address. The code works for a few seconds then prints out No Socket available.

Any help will be appreciated; code below.

#include <SPI.h>
#include <WiFi.h>

int LDR = A0;
int LED = 11;
char ssid[] = "SSID";
char password[] = "password";
int status = WL_IDLE_STATUS;

char server[] = "www.example.com";
int value;

void setup() {
  Serial.begin(9600);
  pinMode(LDR, INPUT);
  pinMode(LED, OUTPUT);
  connectWifi();
  printWifiStatus();
  // postData();
}

void loop() {
  value = analogRead(LDR);
  postData();

  delay(10000);
}

void connectWifi() {
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, password);
    delay(500);
  }
}

void printWifiStatus() {
  // Print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // Print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // Print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

void postData() {
  WiFiClient client;
  if (client.connect(server, 80)) {
    Serial.println("Connecting...");
    if (value > 350) {
      Serial.println("0");
      digitalWrite(LED, LOW);
      String data = "value=0";
      client.print("GET /example/client.php?");
      client.print(data);
      client.println(" HTTP/1.1");
      client.println("Host: www.example.com");
      client.println("Connection: close");
      client.println(); client.println();
      //client.stop();
    } else {
      Serial.println("1");
      digitalWrite(LED, HIGH);
      String data = "value=1";
      client.print("GET /example/client.php?");
      client.print(data);
      client.println(" HTTP/1.1");
      client.println("Host: www.example.com");
      client.println("Connection: close");
      client.println(); client.println();
      //client.stop();
    }
  } else {
    Serial.println("Connection failed");
    client.stop();
  }

}

Output:

Attempting to connect to SSID
SSID: SSID
IP Address: 255.255.255.255
signal strength (RSSI):-47 dBm
Connecting...
1
Connecting...
0
Connecting...
0
Connecting...
0
No Socket available
Connection failed
No Socket available
Connection failed
No Socket available
Connection failed
No Socket available

Actual web address omitted.


texts:
blox w-102 is based on esp32** which (Esp32) can be used as a standalone chip for projects.
Here I want to know how w-102 and samd21g18a are communicating with each other.
If they are communicating then what is the need of doing so?


texts: Is it possible to program an Arduino Pro Mini using an Arduino Uno R3?

texts:
I've recently received an Arduino Pro Mini as a gift, and I don't have an external USB programmer to program the Pro Mini. However, I do own an Arduino Uno R3, and I think it would be possible because they both have the same clock speed and micro-controller (16Mhz with an atmega328).

Is it possible to program an Arduino Pro Mini using an Arduino Uno?
If yes, how does one do so?


texts: Arduino IDE with ATtiny85 error "multiple definition of `__vector_5"

texts:
I am having a problem compiling the code for my ATtiny85 circuit.

I am using the timer/counter0 in normal mode so that when it overflows it triggers the TIMER0_OVF_vect ISR. When I have that ISR in my code, it wont compile and gives this error:

wiring.c.o (symbol from plugin): In function `__vector_5':
(.text+0x0): multiple definition of `__vector_5'
sketch\Glove_heater_v1.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board ATtiny25/45/85.

Maybe I just need to use a different name for the ISR?

My Code:

//Red LED on PB0
//Blue LED on PB1
//Pushbutton PB2
//Battery voltage divider PB3
//Mosfet control PB4

#include <avr/io.h>
#include <stdint.h>
#include <avr/interrupt.h>

volatile uint8_t checkVoltage = 0;

void setup() {

   DDRB = 0b0010011; //set PB0,PB1,PB4 as output, PB2,PB3 as input
   PORTB = 0b00000011; //set PB0,PB1 HIGH so LEDs are off, other pins LOW

   //Setup TC0 for overflow interrupt trigger
   TCCR0B |= 0b00000101; //clk/1024 prescaler
   TIMSK |= 0b00000010;  //set TOIE0 enable overflow interrupt
   sei();
}

void loop() { //do nothing in this test code

}

ISR(TIMER0_OVF_vect){ //Timer/counter0 interrupt check voltage
   checkVoltage = 1;
}

Any ideas are appreciated!


texts: Sending a floating point number from python to arduino

texts:
I am trying to send a floating point number from a python script to an Arduino.  I am not sure how to do this, especially in a pythonic way.

A little bit of research brought me to this very similar question:
How to send numbers to Arduino UNO via Python 3 and the module serial
I vaguely understand why this would work for an int but don't know how to modify it.

1) In this question it makes sense to convert to a char, send, and then convert back to a int by casting on the Arduino, I can't think how to do that for a float.

2) Why do they convert to a Char anyway?

3) What code do I run on the arduino to get this back into a float?

4) Can I use bitwise operators on floating point numbers?

I'm new to python and also to low level programming. I am also aware that python and low level don't mix to well. I am using Linux but ideally I need a cross platform solution. Although I would prefer to get it working then worry about cross platform later.


texts: Arduino emits signal A (infrared) but another Arduino receives everything but A (IR-LED problem)

texts:
Situation: I was trying to make a simple Arduino program that mimics my TV-Remote ON-OFF button.

Diagnosis: It just won't work. So just to check I grabbed another Arduino (2) and added my IR-Sensor to that one and let it look for the signals sent by Arduino (1).

Conclusion: Even though I ran exactly the same program in a loop sending IR signals, Arduino (2) noticed each time another IR signal. The received signals didn't even look like the IR signal I sent.

The program I use to mimic my remote: Link to the Github. It is an example of a Lib

It could be the LED. Just a LED I picked up without being specific. Link to the Documentation of the LED


texts: Error: "'lcd' does not name a type" using LiquidCrystal library

texts:
I'm following an online Arduino tutorial/course and trying to make a simple moving character on an LCD screen, but for some reason I get the following error: "error: 'lcd' does not name a type". I'm using the Tinkercad simulator because my PC's USB ports died recently.
Here's my code:

#include <LiquidCrystal.h>

byte character[8] {
   B01111,
   B01111,
   B01111,
   B00110,
   B01111,
   B01111,
   B01001,

} ;

  LiquidCrystal lcd(12, 11, 2, 3, 4, 5);

  lcd.createChar(0, character); //error is on this line

const int Lbtnpin = 6;
const int Rbtnpin = 7;
int Lbtnprev = HIGH;
int Rbtnprev = HIGH;
int pos = 0;

void setup(){
  lcd.begin(16, 2);
  lcd.clear();
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
}

void loop(){
  lcd.clear();
  int Lbtnstate;
  Lbtnstate = digitalRead(6);
  int Rbtnstate;
  Rbtnstate = digitalRead(7);

  if ((Lbtnprev == HIGH) && (Lbtnstate == LOW) && (pos > 0)) {
     pos--;
  }
  if ((Rbtnprev == HIGH) && (Rbtnstate == LOW) && (pos < 16)) {
     pos++;
  }
  lcd.setCursor(pos, 1);
  lcd.write(byte(0));
  Lbtnprev = Lbtnstate;
  Rbtnprev = Rbtnstate;
}


texts: avrdude : stk500_get sync attempt 10 of 10 not in sync : resp=0x20 how do i get pass this error for ardunio uno board

texts:
When I first started with a bare minimum code. The compiler compiles the code, but when I try to upload, this is the error message I get:

 AVRDUDE: STK500_GETSYNC<> ATTEMPT 10 OF 10 NOT IN SYNC :RESP=0X20

How do I fix this?


texts: I have four servos connected to an arduiono uno and I cannot control them

texts:
I am making a simple bipedal robot. I have four 9g servos connected to my uno. Whenever I try to even do the simplest command, like move right foot 45 degrees it does not work properly. I have tried on my second Uno and i have the same result.

My program for testing the servos:

#include <Servo.h>

Servo myservo;

void setup(){
myservo.attach(6);
}

void loop(){
 myservo.write(45);
}

Each servo wire is attached to a breadboard where they all share power and ground from the arduino. Each servo wire then has another wire going to pins 3,5,6 and 9.

Does anyone know what the problem is and what I can do? Thanks


texts: AVR-Toolchain for Arduino crashes on Mac OSX 10.11.6: Hints or debugging help needed

texts:
My Arduino IDE does not compile any project since I updated from Mac OSX 10.6.8 to 10.11.6.

I even tried reinstalling and also manually installing the original AVR-toolchain. But the behaviour did not change.

I still get the following error messages

signal: bus error
Fehler beim Kompilieren für das Board Arduino/Genuino Uno.

English translation of the error message is:

Error compiling for board Arduino/Genuino Uno.

Is this problem known? I could not find information about it.
Are there any known solutions to it?
Can I start Arduino IDE in debug
mode to give some usefull output what exactly causes the crash?

EDIT

I am using the current IDE 1.8.5 and also tried the nightly builds. I also tried some older versions down to 1.6.0.

EDIT 2:

Arduino 1.0.5 produces the following error:

cc1plus: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Thanks for your help!

EDIT 3

After installing UECIDE (what went smoothly) I am facing the same problem. The error happens in the AVR toolchain when calling the avr-gcc 4.9.2 compiler. In UECID the output tab shows the following output (I added linebreaks for readability):

~/Library/uecide/compilers/avr-gcc/bin/avr-g++
  -c /var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-faf1be1e-2186-438b-9e1a-c56f50ce26d1/MySource.cpp
  -o /var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-faf1be1e-2186-438b-9e1a-c56f50ce26d1/MySource.cpp.o
  -mmcu=atmega328p -g -std=gnu++11 -fno-threadsafe-statics
  -fno-exceptions -ffunction-sections -fdata-sections
  -DF_CPU=16000000L -DARDUINO=106 -DARDUINO_UNO -DARDUINO_ARCH_AVR
  -I~/Library/uecide/cores/arduino/arduino
  -I~/Library/uecide/boards/Arduino/arduino-uno
  -I/var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-faf1be1e-21
86-438b-9e1a-c56f50ce26d1
  -I~/pro/Arduino/MySource -Os -w

The status tab of UECID only shows Compiling Failed.

EDIT 4

After starting UECID from console with --debug --verbose options specified it did print the failing command to console:

~/Library/uecide/compilers/avr-gcc/bin/avr-g++
   -c /var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-5ccb5f12-fcd1-4893-8c41-39fc056ec544/MySourve.cpp
   -o /var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-5ccb5f12-fcd1-4893-8c41-39fc056ec544/MySourve.cpp.o
   -mmcu=atmega328p -g -std=gnu++11 -fno-threadsafe-statics
   -fno-exceptions -ffunction-sections -fdata-sections
   -DF_CPU=16000000L -DARDUINO=106 -DARDUINO_UNO -DARDUINO_ARCH_AVR
   -I~/Library/uecide/cores/arduino/arduino
   -I~/Library/uecide/boards/Arduino/arduino-uno
   -I/var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-5ccb5f12-fcd1-4893-8c41-39fc056ec544
   -I~/pro/Arduino/MySourve -Os -w

This command is identical to the one created by Arduino.

I found another hint on a bug in gcc 4.8 that seems not to be AVR specific.

After reducing the command line to

~/Library/uecide/compilers/avr-gcc/bin/avr-g++
  -c /var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-5ccb5f12-fcd1-4893-8c41-39fc056ec544/MySource.cpp
  -o /var/folders/2h/8pdnzj197tq906bzs81ksn6m0000gn/T/build-5ccb5f12-fcd1-4893-8c41-39fc056ec544/MySource.cpp.o

the crash stays the same: Segmentation fault 11


texts: Burn bootloader into Arduino UNO from Arduino Duemilanove

texts:
I have been working with my Arduino UNO for 2-3 hours and after that it was not possible to load sketchs into the board since it returns a

  "avrdude: stk500_recv(): programmer is not responding" error.

The internal led "L" of the board is permanently on.

After a little research I guess that the bootloader was corrupted at some point (I still don't understand when and how).

Q: Apart from this board I have an Arduino Duemilanove board and I would like to know if it is possible to use this Duemilanove board to burn the bootloader in the broken board, is this possible? in afirmative case, how?

Since all the examples over there shows how to do it with the same board and not with a different one.


texts:
I'm trying to create an ISR which operates for 15 seconds when a particular button is pressed. I'm attempting to use the AVR functions on my Arduino Uno to start counting when it enters the ISR, then quit the loop when it reaches 15 seconds.

I'm having difficulty reasoning out where the counter is actually stored that I want to use for my while loop.

Here is my code so far:

#define button_pin 2
#define duration 15
#define osc_in 0

#include <avr/io.h>
#include <avr/interrupt.h>

const float convert = 5.0/1023.0;

void setup() {

  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1 = 0;
  attachInterrupt(digitalPinToInterrupt(button_pin), button_interrupt, CHANGE);

  sei();

  pinMode(button_pin, INPUT);
  Serial.begin(9600);
}

void loop() {
    //int channel1 = analogRead(osc_in);

//while (millis() < 10000)
  //Serial.println(millis());
  //Serial.println(channel1 * convert);
  //channel2 = channel1;
}

void button_interrupt(){
  //(# timer counts + 1) = (target time) / (timer resolution)
  //int timer_counts = duration/(pow(6.4, -5));
  //int dur = 234374;
  OCR1A = 234374;
  TCCR1B |= (1 << CS10);

  while (????????){
    int channel1 = analogRead(osc_in);
    Serial.println(channel1 * convert);
  }
}


texts: ST7789 TFT display only shows a correct image while Arduino reset button is held down - Why?

texts:
I am trying to get the ST7789 TFT display to work with Arduino. I followed online guides  for connections and am using the fast library fron github and included workbench ino (https://github.com/cbm80amiga/Arduino_ST7789_Fast).
Problem: The program runs and drives the display but the image is corrupt and only partial. I discovered that if I quickly and firmly press the reset button - and keep it pressed down - the image at the moment of reset press suddenly becomes full and good (albeit static because reset is pressed). Ofcourse as soon as I release the reset button the program restarts with the same corrupt image (the pictures below illustrate the issue).

I could not find a description of this particular problem by online searching. Here is what I tried to fix it (all to no avail):

I confirmed all pins are correct as defined in the ino script.
I ensure only the 3.3v power line is used. I have never connected the Vcc to 5 v
I tried with a genuine Arduino UNO as well as a clone - both show the same behaviour.
I used 1k:2k resistor voltage dividers for the data lines, res and DC - these did not help. In fact the display did not work at all with the voltage dividers, only the backlight came on and the screen flickered slightly. I checked that I was getting ~3v in the middle of each divider.
I used two separate ST7789 display boards, bought from two separate sellers on different occasions - both show the same behaviour.

[Edits in response to comments below]

The same behviour occurs when using a sketch that uses the standard Adafruit libraries (as opposed to the fast library linked above).
The same corruption is seen when run on an arduino nano clone. However, with the nano, pressing the reset button shows only a fleeting glimpse of the full image prior to resetting (i.e. holding down the reset button does not preserve a static image on the screen).

Any ideas about what is going on and how to fix it? Thanks.


texts: Split arduino run mode depending on active USB connection

texts:
Ok, so i have a unit that i want to add information to the EEPROM, using the USB port, such as SSID for wifi shields.

Then i want to disconnect the USB cable, plugin a battery and then it should run its normal loop.

So something like:

IF usb-cable
   run_setup_loop();
ELSE
   run_main_loop();


texts:
I made a simple circuit controlled by the ATMEGA IC then tried to encase it in resin. It died. What is the thing that caused it to die? I've had other circuits working fine in resin. I want to try again, what steps can I take to prevent this?

I've looked for obvious shorts but can find none.

Resin heats up when it cures, could that be the issue?


texts: How to read an analog value on ESP32-CAM with the SD card reader enabled?

texts:
I use an ESP32-Cam module for a project for which I need both the SD card and the cam. According to this page, the only pins that are not in use by either the camera or the SD card reader are GPIO0, GPIO2 and GPIO16. However, I need to read an analog value, which is only possible with the pins 12-15, 2 and 4, as the Arduino forums state, which are all in use by the SD card reader.
However, I came across a way to make the SD reader leave the GPIO4 pin out, namely by initializing it with
SD_MMC.begin("/sdcard", true);

Now the flashlight does not light up anymore when accessing the SD card, which means that there is no output anymore to GPIO4. However, it still does not allow me to read the pin after the SD card has been initialized. I also tried "converting" the pin to a GPIO through
pinMode(4, FUNCTION_3);

but it did not make a difference.
So my question is: How can pin 4 be used to read analog values while still keeping the SD card reader functional? And if this is not possible, is there any other way to read an analog value into the ESP32-CAM?


texts:
I am working on a project with a 3-Wheel Car: 1 Custer Wheel, and 2 DC Motors. I need to steer the car playing with the speeds of these two dc motors. If I would supply a constant voltage and current to the DC motors, is there an equation or maybe a source to know the exact degree of turning by assigning PWM to a certain value? Let's say I want to turn the car 30 Degrees to the left from the straight direction. Can I do calculations to find all of the PWM values or it can only be got through experiments?
Thanks in Advance!


texts: How do I connect my Arduino to a FT-H30 thermal sensor?

texts:
I want to use my Arduino to measure from a thermal sensor that I’m not familiar with and I'm trying to figure out what are the proper steps to take. The device is a FT-H30 thermal sensor with FT-50A amplifier. I have the instruction manual and specification sheet (information below).

The sensor outputs as a 4mA to 20mA analog signal. I have not measured via current change before, how can I set this up with the Arduino?

The spec sheet has some circuit diagrams. Can I simply copy them or do I need to add some protection between the amplifier and the Arduino? It seems from the spec sheet that I should measure current, not voltage.

What precautions should I take to prevent damaging the sensor or Arduino?

Sensor: FT Intelligent Series Thermo Sensor, FT-H30. Run through amplifier FT-50A.


texts: Can I generate a PWM signal for a Mosfet driver using a saw tooth wave and sine wave through Arduino ?


texts: Update button state in Blynk app through the code

texts:
I'm using Blynk along with a WeMos D1 R2 and i can change modes through an ON/OFF button.

I can succesfully change mode and make my application go from mode 1 (irrigation) to mode 2 (Fertilization), but through the code i manage to switch from mode 2 to mode 1(after my code does what it is meant to do).

However, i cannot make the button show up as being in mode 1 again, if the application is working properly in mode 1. Any ideas on how to update button condition?

My code follows(below the code you can see the app and the button Using the V1 virtual pin):

void setup()
{
  Serial.begin(9600);             // opens serial port, sets data rate to 9600 bps
  Blynk.begin(auth, ssid, pass);
  pinMode(Relay1, OUTPUT);        // Setup Relay pin as output pin
  pinMode(Relay2, OUTPUT);        // Setup Relay pin as output pin
//pinMode(led_pin, OUTPUT);
  pinMode(sensor_pin, INPUT);
  digitalWrite(Relay1, LOW);
  digitalWrite(Relay2, LOW);
  digitalWrite(Relay1,HIGH);
  digitalWrite(Relay2,HIGH);

}

BLYNK_READ(V8)
{
  Blynk.virtualWrite(8,level);    // virtualpin 8 distance
}

BLYNK_WRITE(V1)
{
  pinValue = param.asInt();
}

BLYNK_READ(V5)
{
  Blynk.virtualWrite(5,RH);       // virtualpin 8 distance
}

BLYNK_READ(V6)
{
  Blynk.virtualWrite(6,temp);     // virtualpin 8 distance
}

void loop()
{
  Blynk.run();
  timer.run();
  if (pinValue==0)
  {
    // some code here
  }
  else //(digitalRead(sensor_pin) == 1)
  {
    // some other code
  }}

else {
  // a lot of code here
  pinValue=0;                     // here i set pinValue to 0 again in order to return to mode1
}
}
BLYNK_READ(V1)
{
  Blynk.virtualWrite(1,pinValue); // virtualpin 1 state
}

//End of program


texts: How can I increase resolution for current sensor?

texts: I purchased a ACS711 Hall effect-based linear current sensor (http://www.pololu.com/product/2197) and when i read the input it's basically always the same. After doing some research I think it's because there is only a 10bit AD converter and since the current is only changing a little bit it's not enough to catch the change. For my situation I'm pulling around 40-90ma idle and when the motor turns on it jumps up so I want this sensor to see that but it only jumps up to about 120ma. Any tips on how to fix this? Maybe a different sensor? Can I use an amplifier to boost the analog signal?


texts: How can I use IRsend with a string or convert a char from serial to uint32_t?

texts:
I'm trying to control my arduino with a raspberry pi with python instead of C++ (which I don't know). I've found code to take a string from serial and print it, but instead I'd like to use IRsend to use the code. Unfortunately I'm getting the error invalid conversion from 'char*' to 'uint32_t {aka long unsigned int}' [-fpermissive]. I know this must be an incredibly dumb question but is there a int() function for uint32_t for arduino C++? that I could set blah=uint32_t(buf) and then use my irsend.sendNEC(buf, 32)? If it's not painfully obvious, I don't know C++ and my python isn't great.
#include <IRremote.h>

char buf[80];

int readline(int readch, char *buffer, int len) {
  static int pos = 0;
  int rpos;

  if (readch > 0) {
    switch (readch) {
      case '\r': // Ignore CR
        break;
      case '\n': // Return on new-line
        rpos = pos;
        pos = 0; // Reset position index ready for next time
        return rpos;
      default:
        if (pos < len-1) {
          buffer[pos++] = readch;
          buffer[pos] = 0;
        }
    }
  }
  return 0;
}

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

IRsend irsend;

void loop() {
  if (readline(Serial.read(), buf, 80) > 0) {
    Serial.print("You entered: >");
    Serial.print(buf);
    Serial.println("<");
    irsend.sendNEC(buf, 32);

  }
}

Error:
/home/pi/Desktop/sendIRfromserial2addingir/sendIRfromserial2addingir.ino: 39:27: warning: invalid conversion from 'char*' to 'uint32_t {aka long unsigned int}' [-fpermissive]
             irsend.sendNEC(buf, 32);

                  ^

In file included from
/home/pi/Desktop/sendIRfromserial2addingir/sendIRfromserial2addingir.ino:1:0:
/home/pi/Arduino/libraries/IRremote/src/IRremote.h:444:10: note:   initializing argument 1 of 'void IRsend::sendNEC(uint32_t, uint8_t, bool)'
     void sendNEC(uint32_t data, uint8_t nbits, bool repeat = false);
          ^~~~~~~`


texts: How do I best connect with Arduino programmers who are willing to design small projects for some extra cash?


texts: ESP8266MOD does not respond to my Uno (Custom board) AT+RST command

texts:
This is my very first project with a Uno board and ESP module. I have some experience with 8051 uP. I'd like some guidance in addressing my issue.

Objective:

To connect ESP8266MOD to my wifi network and send a TCP message to my HOME_SERVER whenever required.

Hardware Module:
UNO (Induino R5 Arduino R3 USB Clone Board) --> level shifter  --> ESP8266MOD

As a first step, I am trying to send AT+RST command from the Uno to the connected ESP. But there is no response from the ESP. However, I am able to notice a LED blink on the ESP, whenever there is TXD operation in my Uno.

Hardware Connection:

UNO - Uses USB Power supply from laptop
ESP8266MOD- Uses 3 1.5V AA Batteries

                 ||
    UNO PINS       TXD      RXD     5V GND
                    ||      ||      ||
    LEVELSHIFTER     >>RXI   <<TXO  HV,GND
                        ||      ||
                    RXO<<    TXI>>  LV,GND
                    ||      ||      ||
    ESP8266MOD      RXD     TXD     3.3V,GND

ESP8266MOD Settings:
    CH_PD ->> 3.3V
    GPIO2 ->> 3.3V
    GPIO0 ->> GND
    GPIO15->> GND

Uno Code:

#include <SoftwareSerial.h>

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial ESP8266 (rxPin, txPin);

void setup() {
  Serial.begin(9600);
  ESP8266.begin(9600); // Change this to the baudrate used by ESP8266
  delay(3000); // Let the module self-initialize
}

void loop() {
  Serial.println("Sending an AT command...");
  delay(3000);
  ESP8266.println("AT+RST");
  delay(30);
  String response = "";
  while(ESP8266.available()) {
    char c = ESP8266.read();
    response+=c;
  }
  if(response != "") {
    Serial.println(response);
  } else {
    Serial.println("Empty\r\n");
  }
}

Output Video: Output video view

  -->


texts:
My code uploads to Arduino but the motor is not moving when I connect it to the L293d motor driver shield. I am supplying 12V 2A to the shield through an adapter, connected to dc motor at M2. tThis is the code I am using
#include <AFMotor.h>

AF_DCMotor motor(2);

void setup()
{
  //Set initial speed of the motor & stop
  motor.setSpeed(200);
  motor.run(RELEASE);
}

void loop()
{
  uint8_t i;

  // Turn on motor
  motor.run(FORWARD);

  // Accelerate from zero to maximum speed
  for (i=0; i<255; i++)
  {
    motor.setSpeed(i);
    delay(10);
  }

  // Decelerate from maximum speed to zero
  for (i=255; i!=0; i--)
  {
    motor.setSpeed(i);
    delay(10);
  }

  // Now change motor direction
  motor.run(BACKWARD);

  // Accelerate from zero to maximum speed
  for (i=0; i<255; i++)
  {
    motor.setSpeed(i);
    delay(10);
  }

  // Decelerate from maximum speed to zero
  for (i=255; i!=0; i--)
  {
    motor.setSpeed(i);
    delay(10);
  }

  // Now turn off motor
  motor.run(RELEASE);
  delay(1000);
}

[


texts: Neopixel led strip stops responding after change in brightness

texts:
I have an arduino UNO hooked up to a neopixel LED strip with 148 lights.  Most of the time it works fine, but when I upload a program that changes the brightness frequently, particularly when I increase brightness, only the first 8 LEDs continue responding.  The rest get stuck.

Here's an example of the kind of code that sets this issue off.  To fix it, I usually have to restart the lights and the arduino and sometimes upload a blank program to the arduino.

I'm pretty new to arduino programming so and help would be really appreciated.  Thank you.

#include "FastLED.h"

FASTLED_USING_NAMESPACE

// FAST LED definitions
#define DATA_PIN    3
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS    148

CRGB leds[NUM_LEDS];
#define DATA_PIN 3 // Output Pin to Data Line on Strip

int fadeAmount = 5;
int brightness = 0;

void setup()
{
   FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
}

void loop()
{
   for(int i = 0; i < NUM_LEDS; i++ )
   {
   leds[i].setRGB(0,255,0);
   leds[i].fadeLightBy(brightness);
  }
  FastLED.show();
  brightness = brightness + fadeAmount;
  // reverse the direction of the fading at the ends of the fade:
  if(brightness == 0 || brightness == 255)
  {
    fadeAmount = -fadeAmount ;
  }
  delay(20);
}


texts: Does AWG size affect signal from sensors?

texts:
Would using a thicker cable like 16 AWG affect the signal being received from an RFID or Ultrasonic sensor?

I understand AWG can make a significant impact on voltage when a thick cable is used over a long distance. In my head signal data is delicate so a nice thin wire will ensure little disturbance....

Looked around and couldn't find a clear answer so hopefully someone can help!


texts: Uploading Error: no programmer has been specified

texts:
Whenever I upload a code I get this error:

avrdude: no programmer has been specified on the command line or the config file
         Specify a programmer using the -c option and try again

I am able to upload from other PCs, but ever since I got the newest IDE, it stopped working. I even tried downgrading to 1.6.8, and still i get this error... Any help? Thanks,

Sean


texts: Powering Arduino Uno, CAN Crocodile and NeoPixels from Car

texts:
I have purchased a cigarette adapter that gives me 2 USB ports, however this gives me 5v and up to 2.4A.

Thats ok for powering the Arduino Uno, I need 12/24v to power the CAN crocodile.

I also want to drive quite a lot of NeoPixels.

How can I do this?


texts: Having trouble using RTC if I set an ISR for a 1 second timer

texts:
I built a sketch using some timer ISR code to get a trigger every second.  (for the Atmega328 chip I use the following code I got form the internets.  It works)

It runs fine and I get a trigger/callback every second.

void setupAtmega328()
{
#ifdef __AVR_ATmega328P__

//      traceDebug("setupAtmega328() entry");

    cli();  // stop interrupts

//    traceDebug("setupAtmega328() 1");

            //set timer1 interrupt at 1Hz
    TCCR1A = 0;// set entire TCCR1A register to 0
    TCCR1B = 0;// same for TCCR1B
    TCNT1 = 0;//initialize counter value to 0
              // set compare match register for 1hz increments
    OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
                  // turn on CTC mode
    TCCR1B |= (1 << WGM12);
    // Set CS12 and CS10 bits for 1024 prescaler
    TCCR1B |= (1 << CS12) | (1 << CS10);
    // enable timer compare interrupt
    TIMSK1 |= (1 << OCIE1A);
//  traceDebug("setupAtmega328() 2");
    sei();//allow interrupts
//  traceDebug("setupAtmega328() 3");

#endif
}

I also wanted to add the capability of a real time clock (RTC) so I got a DS3231.

I downloaded and ran the sample app from this RTCLib on github

The sample code works fine when running under the Arduino IDE

However, when I add the RTC code to my sketch I don't get the results I want/expect.

Specifically, the program seems to hang/halt at the call to:

cli();

I am new to the Arduino platform and not sure what I am missing.
What do I need to do to get the RTC to work in conjunction with an ISR?

I wired the RTC according to the directions from Adafruit's site

I have other arduino boards that use different ISRs, but I have not tried them yet with the rtc since the 328 seems to be the standard arduino boars that is used to do initial work/testing.

How can I use the 3231 RTC AND a 1 second ISR/callback?

EDIT:
I removed the trace/serial output - I had originally added those to track the code to see where I got but i think I exacerbated or added problems in doing that.

for those interested the code is at https://github.com/tjurik/Intervalometer


texts: Data from RC522 to firebase real time database

texts:
#include<ESP8266WiFi.h>
#include<SPI.h>
#include "MFRC522.h"
#define RST_PIN D3
#define SS_PIN D4
MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();
}

void loop() {
  if ( !mfrc522.PICC_IsNewCardPresent() ) {
    delay(50);
    return;
  }

  if ( !mfrc522.PICC_ReadCardSerial() ) {
    delay(50);
    return;
  }

  Serial.print(F("Card UID: "));
  dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
  Serial.println();
}

void dump_byte_array(byte *buffer, byte bufferSize) {
  for ( byte i = 0; i< bufferSize; i++ ) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], HEX);
  }
}

I am able to get the unique ID of the RFID tag & card. But now the problem is that how can I send the unique ID from ESP8266 to the firebase realtime database.

The hexadecimal values that are generated are they unique? or they are something else? Because in some youtube videos I saw people using only numbers as a unique ID from RFID to distinguish between 2 cards or tags.

The wifi connection and firebase auth all are set peoperly ony the unique id number is the problem.


texts: Avrdude verification error after months of successful use

texts:
I have a 2560 that I've been working with for a while (over a year for sure), programming it with an avrisp mk2. No issue this whole time, then suddenly, a couple of days ago it starts failing with

avrdude: verification error, first mismatch at byte 0x0002
         0x01 != 0x95
avrdude: verification error; content mismatch

And very obviously not flashing (there's logic that blinks the LED on boot, and the LED isn't blinking anymore).

The first time this happened, the board appeared completely dead - the programmer wouldn't recognize it, and refused to flash it. After a few days and magic it started recognizing it again, and going through the motions of flashing my firmware, but the verification error persists. The location of the error hasn't changed, nor has the two values (0x01 vs 0x95).

Any ideas what this could be?


texts: Value keeps incrementing even though loop has terminated, why?

texts:
I use a double called delta and use that to turn off an LCD if delta is larger than the timeout threshold. Once that happens, delta is supposed to set to 0 and then other parts of the program run. However, delta continues to increment and I'm not sure why.
This is causing a problem because delta is used to determine if the device should "sleep". So when I try to wake up the device via button click, delta is always way past the timeout threshold and the device immediately goes back to sleep.
Any thoughts as to why? Thanks in advance.
#include <M5StickC.h>

double BUTTON_PRESS_NEXT_PRESS_TIME= .5; //Time in seconds
double MINIMUM_BUTTON_PRESS_TIME = .05; //Time in seconds
int BUTTON_PRESS_SLEEP = 3; //Time in seconds
int SCREEN_TIMEOUT = 5;
int count;

static int pressCount = 1;
static int nextPress= 1;

static bool buttonIsPressed;

void setup(void) {
  buttonIsPressed = false;
  M5.begin();
  M5.Lcd.setRotation(0);
  M5.Lcd.fillScreen(TFT_BLACK);
  M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK);

  // Datum is middle centre
  M5.Lcd.setTextDatum(MC_DATUM);
  M5.Axp.ScreenBreath(100);

  updateScreen();
}

void updateScreen() {
   char tmp[12];

  // Datum is middle centre
  M5.Lcd.setTextDatum(MC_DATUM);
  M5.Lcd.drawString(dtostrf(pressCount,4,0,tmp), 80,60,6);
  M5.Lcd.drawString(dtostrf(nextPress,3,0,tmp), 80,100,6);
}

static void evaluatePress(double d) {
   // Evaluate press
  if (d >= BUTTON_PRESS_NEXT_PRESS_TIME) {
    nextPress++;
    pressCount = 1;

    if (nextPress == 19) {
      nextPress= 1;
    }
  }
  else if (d >= MINIMUM_BUTTON_PRESS_TIME && d < BUTTON_PRESS_NEXT_PRESS_TIME) {
    pressCount++;
  }

  updateScreen();
}

void sleepLoop() {
  bool bIsPressed = false;
  Serial.println("Sleep 1");
  while(1) {
    Serial.println("Sleep 2");
    if (digitalRead(M5_BUTTON_HOME) == LOW && !bIsPressed) {
      bIsPressed = true;
    }

    if (digitalRead(M5_BUTTON_HOME) == HIGH && bIsPressed){
      Serial.println("BREAKY BREAKY");
      M5.Axp.ScreenBreath(100);

      break;
    }
  }
}

void awakeLoop() {
  double delta;
  double old_time;
  double current_time;

  Serial.println("Awake 1");

  while(1) {
    Serial.println("Awake 2");
     //Calculate delta time
    old_time = current_time;
    current_time =  millis();
    delta = delta + (current_time - old_time)/1000;

    if (digitalRead(M5_BUTTON_HOME) == LOW && !buttonIsPressed) {
      buttonIsPressed = true;
      delta = 0;
    }

    if(digitalRead(M5_BUTTON_HOME) == HIGH && buttonIsPressed) {
      buttonIsPressed = false;
      evaluatePress(delta);
      delta=0;
    }

    if(delta > SCREEN_TIMEOUT && !buttonIsPressed) {
      Serial.println(delta);
      Serial.print("BREAK AWAKE");
      Serial.println(M5.Axp.ScreenBreath(0));
      count = 0;
      break;
    }
    else {
      count++;
    }
  }

  delta = 0;
}

void loop() {
  awakeLoop();
  sleepLoop();
}


texts: Why doesn't OTA work with the Ai-Thinker ESP32-CAM board?

texts:
I have working code on an Ai-Thinker ESP32-CAM board, programming over serial.

I would like to reprogram using OTA, but adding in the functionality from the BasicOTA sketch (which I have done on various other boards successfully) fails when OTA programming is attempted, the board reboots following an abort() and a stack trace is generated.

The invaluable ESP32 exception decoder shows the fault occurs from checking if memory location is safe to write.

Normally, I would choose a partition option which includes OTA, but the Ai-Thinker board doesn't have this option in the IDE


texts: Arduino nano to esp8266 level shifting needed?

texts:
I want to connect an Esp8266 Wifi module to an Arduino nano. I am wondering if I need to implement level-shifting for the Arduino TX line to Esp RX line?

I find different schema's on the net. Some with, some without level-shifting:

With:
http://community.blynk.cc/t/robot-with-esp8266-shield-and-arduino-nano/3316/8

Without:
Arduino Nano v3.0 with ESP8266

Some use a capacitor between GND and Esp CH_PD pin, others use a 10K resister between the 3.3V and the CH_PD pin (https://blogs.msdn.microsoft.com/abhinaba/2016/01/23/esp8266-wifi-with-arduino-uno-and-nano/)...

What is the most basic but required setup for a Arduino Nano and a Esp8266?
(I have Esp8266-12e modules)

Thanks!


texts: : Failed to open /dev/ttyACM0 (port busy)

texts:
I am trying to work with the (new) sparkfun razor IMU 9dof, I wrote a silple sktetch to calibrate the magnetometer:

#include <SparkFunMPU9250-DMP.h> // Include SparkFun MPU-9250-DMP library
#include <Wire.h> // Depending on your Arduino version, you may need to include Wire.h
MPU9250_DMP imu; // Create an instance of the MPU9250_DMP clas
void setup() {
  Serial.begin(115200);

  Serial.println(F("Adafruit 10 DOF Board AHRS Calibration Example")); Serial.println("");

  if (imu.begin() != INV_SUCCESS){
    while (1) {
    Serial.println("Failed to initialize MPU-9250, loop forever");
   }

  }

 imu.setGyroFSR(2000); // Set gyro to 2000 dps

 imu.setAccelFSR(2); // Set accel to +/-2g

 imu.setLPF(5); // Set LPF corner frequency to 5Hz

 imu.setSampleRate(100); // Set sample rate to 10Hz

imu.setCompassSampleRate(100); // Set mag rate to 10Hz
}

void loop(void){
  imu.update();

  // Print the sensor data
  Serial.print("Raw:");
  Serial.print(imu.ax);
  Serial.print(',');
  Serial.print(imu.ay);
  Serial.print(',');
  Serial.print(imu.az);
  Serial.print(',');
  Serial.print(imu.gx);
  Serial.print(',');
  Serial.print(imu.gy);
  Serial.print(',');
  Serial.print(imu.gz);
  Serial.print(',');
  Serial.print(imu.mx);
  Serial.print(',');
  Serial.print(imu.my);
  Serial.print(',');
  Serial.print(imu.mz);
  Serial.println();

  delay(50);
}

To be sure the Arduino IDE can access to dev/ttcACM0, I did   sudo chmod 666 /dev/ttyACM0

I can dowload successfully but when I want to open the terminal I got the following error:

Erreur d'ouverture du port série « /dev/ttyACM0 ». (Port busy) (see attached screenshot)

More over when I entered dmesg on the console, I can see the following messages:

[   94.133923] usb 3-2: USB disconnect, device number 2
[   94.133978] cdc_acm 3-2:1.1: urb 12 failed submission with -19
[   94.135862] cdc_acm 3-2:1.1: urb 13 failed submission with -19
[   94.136059] cdc_acm 3-2:1.1: urb 14 failed submission with -19
[   94.136257] cdc_acm 3-2:1.1: urb 15 failed submission with -19
[   94.136457] cdc_acm 3-2:1.1: urb 2 failed submission with -19
[   94.136656] cdc_acm 3-2:1.1: urb 3 failed submission with -19
[   94.136852] cdc_acm 3-2:1.1: urb 5 failed submission with -19
[   94.137048] cdc_acm 3-2:1.1: urb 6 failed submission with -19
[   94.138841] xhci_hcd 0000:03:00.0: WARN Cannot submit Set TR Deq Ptr
[   94.138843] xhci_hcd 0000:03:00.0: A Set TR Deq Ptr command is pending.
[   94.931853] usb 3-2: new full-speed USB device number 3 using xhci_hcd
[   95.316578] usb 3-2: New USB device found, idVendor=1b4f, idProduct=9d0f
[   95.316581] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   95.316582] usb 3-2: Product: SFE 9DOF-D21
[   95.316584] usb 3-2: Manufacturer: SparkFun
[   95.320306] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[  858.774849] usb 3-2: USB disconnect, device number 3
[  904.529058] TCP: wlp1s0: Driver has suspect GRO implementation, TCP performance may be compromised.

Does anyone outhere experienced such issue?

Thank you for your help

Fabrice


texts:
I am an adruino hobbyist, i want to make sine wave using arduino uno,
for that i using timer0 as interrupt, OCR0A set to 17 for 3.6khz interrupt(16000000/(100hz*36 interval)/256-1),
If i am using only one pwm pin i am getting correct frequency but when i enable two pwm pin i am getting only half if the frequency, kindly advise what is wrong and how to correct it.
.................................
This code i am getting correct frequency at PWM pin 9.

//

ISR(TIMER0_COMPA_vect)
{
OCR1A=(256+((((sin(num*3.14/180))*256))))/2;
//OCR1B=(256+((((sin(num*3.14/180))*256))))/2;
     num=num+10;
    if(num >= 360)
{
       num = 0;
    }
}

//
............................
This code i am getting only half of the previous frequency at PWM pin 9,10

//

ISR(TIMER0_COMPA_vect)
{
OCR1A=(256+((((sin(num*3.14/180))*256))))/2;
OCR1B=(256+((((sin(num*3.14/180))*256))))/2;
     num=num+10;
    if(num >= 360)
{
       num = 0;
    }
}

//


texts:
I'm learning about accessing ports directly on the ATMEGA 328 using an Arduino Uno. The program sets up pin 13 as an output and pin 2 as an input. I then enable the pull up resistor on pin 2.

I read Pin 2 and set the LED high or low depending on if pin 2 is high or low.

Why is it that I cannot seem to use == HIGH in my if statement instead of != LOW?

void setup() {
  MCUCR &= ~(1 << 4); //disables pull-up disable (redundant as default is off)
  DDRB |= (1 << 5); //sets pin 13 (B5 on ATMEGA 328) as output
  DDRD &= ~(1 << 2); //sets pin 2 (D2 on ATMEGA 328) as input (redundant as default is input)
  PORTD |= (1 << 2); //since it's an input sets pull-up resistor ON
  PORTB &= ~(1 << 5); //sets pin 13 (B5 on ATMEGA 328) as LOW

}

void loop() {
  if ((PIND & (1 << 2)) != LOW) PORTB |= (1 << 5); //sets pin 13 (B5 on ATMEGA 328) as HIGH
  else PORTB &= ~(1 << 5); //sets pin 13 (B5 on ATMEGA 328) as LOW
   delay(100);

}


texts:
I'm reading two digital inputs and one analog input. For [reasons] I must use A0 and A1 as digital ins, and A2 as an analog in.

I'm uncertain about how the Arduino hardware deals with mixing analog and digital inputs on the same port. For speed, I'm reading like this:

 uint8_t raw = PINC;
 boolean digitalA = (bool)(raw & 1);  // read A0
 boolean digitalB = (bool)(raw & 2);  // read A1
 int analogC = analogRead(A2);

Will the raw reading of the port interfere with the analogRead in any way? I did see a caveat about mixing A & D, but it only had to do with noise introduced in the analog ins when doing digital outs. Would reading analog first minimize that?


texts: Arduino IDE: Board nodemcuv2 (platform esp8266, package esp8266) is unknown

texts:
I am receiving this error after reinstalling Arduino IDE (everything was working fine [same components, same code]):

  Board nodemcuv2 (platform esp8266, package esp8266) is unknown

I have recently reinstalled ESP8266 libraries. Could that have caused this issue?


texts: (SOLVED) Fast HW check: (18 digital + 4 analog to I2C ) Arduino Mini Pro + MCP23017 or STM32?

texts:
Arduino Mini Pro+MCP23017 or  STM32

I want make device, which reads 17 digital buttons and 4 analog, process it somehow and send the result to I2C bus. Also there is a LED to be managed. I may want to attach some wireless too later, but I am not really sure, if I woud do it (which would need 5-6 mor digital pins). I need to update the firmware often, as it is under heavy developement just now. I should make the PCB as soon as possible, but programming can wait some time.

The PCB would have buttons and analogs on it (and MCP in the arduino case). Also lot of connectors, like I2C, programming interface and some power regulators, the LED (or maybe more of them, if there was few free pins, but it is not mandatory). The processor will be connected via wires for space reasons (and maintainability and the board may be redesined later), so only long row of soldering pads on PCB for it.

Main decision:
If I opt to Arduino, then MCP will be part of the PCB and connected to I2C bus, if I use STM32, no MPC will be present and buttons would go directly to output connector.

Making the HW is no problem for me, the logic inside is also easy (basically read all inputs, normalize analogs to some range, make some simple tests and if desired, send result over I2C. Reply to some simple I2C too.)

I have a lot of Arduino Mini Pro, but it is few legs short for the task, so I would use MCP23017 expander for 16 of that digital buttons.

I also got some these STM32
https://www.aliexpress.com/item/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduino/32279776568.html but did not open the package yet. Anyway I want to learn to use them "sometimes soon".

Maybe it is just the kind of starter project, which I would like to do.

Now I am just not sure about the number of available pins on the STM32, on first look it have more pins, but each description I found yet states too much details about additional functions, but I got confused about the basics here. So my question is:

Can mentioned STM be easilly programed as Arduino, manage I2C communication, and still have comfortable 18+4 I/O pins free? And 23+4 I/O free?


texts:
This is the MCU: http://www.microchip.com/wwwproducts/en/ATtiny88 - it advertises a hardware I2C interface, but I am struggling with it. It is mounted on my own board (which worked fine if I dropped an ATMega instead).

edited - prev screencapture were from an ungrounded logic analyzer

First tried the Femtocow ATTiny - it has complained about no Wire library at the #include Wire.h line. So i went into C:\Program Files\Arduino\hardware\arduino\avr\libraries, grabbed the Wire folder and copied it into C:\Program Files\Arduino\libraries. Compiled fine, loaded the binary with avrdude, got a few first TWI communication fine, then it started trashing.

Second attempt was with the cores from Drazzy ATTinycore which came with its own Wire library. Compiled fine, loaded the binary and got the same behaviour.

This is how the messed up I2C line looks in both cases. Starts fine, then appears to go wonky, after a few of these wonky bursts the lines go silent. Also, in spite of having changed the frequency to both 100 and 400 kHz i have this weird 1.953 kHz clock...

#define F_TWI             400000L
//#define F_TWI             100000L

....

  Wire.begin(); // Initiate the Wire library
  Wire.setClock(F_TWI);

I am using Arduino 1.8.2. Anything gives ?


texts: Pro Mini 3.3v + Neopixel not working when disconnected from USB

texts:
I'm doing a project using an Arduino pro mini 3.3v and Adafruit's Neopixel.
I've flashed an example (strand example) from the Adafruit Neopixel's library sketch into the Arduino using the FTDI Basic Breakout 3.3v and everything went fine.

But when I disconnected the FTDI Basic Breakout from my laptop, the LEDs stop working. They light up with some different color and the animation stops.

I tried with other example sketches and everything seemed to work fine. I never experienced anything like this and I had no success searching for this issues in forums or google.

What might be the problem and how can I solve it?

Thanks!


texts: Exit from for function after detecting obstacles

texts:
#include <HCSR04.h>

int red = 13;
int green = 12;
int blue = 11;
int trigger = 9;
int echo = 8;
int halt;

void setup(){
  pinMode(red, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(trigger, OUTPUT);
  pinMode(echo, INPUT);
  Serial.begin(9600);
}

void redLed(){
  rgb(255,0,0);
  delay(200);
}

void rgb(int r, int g, int b){
  analogWrite(red, r);
  analogWrite(green, g);
  analogWrite(blue, b);
}

void fadeBlu(){

    for (int i=0; i<=255; i+=5){
    rgb(0,0,i);
    delay(40);

    Serial.print("halt in IF is ");
    Serial.println(halt);
    }

    for(int i=255; i>=0; i-=5) {
      rgb(0,0,i);
      delay(40);

      Serial.print("halt ELSE is ");
      Serial.println(halt);
    }
}

void human() {

  UltraSonicDistanceSensor distanceSensor(trigger, echo);
  double distance = distanceSensor.measureDistanceCm();
  halt = 0;

  // cover sensor
  if (distance<=30) {
    halt=0;
    redLed();
  }
  // no cover
    halt=-1;
    fadeBlu();
}

void loop(){
  human();
}

I'm looking for a way to exit from "for" loop of fadeBlue() function if the hand is detected in front of sensor. I would like that in any case of fading and if there is hand in front of sensor the led became red. In my code the led doesn't stay red if I had hand in front of the sensor and also the value of "halt" doesn't change. I put some serial.println to make debugging.


texts:
I'm attempting to use an Arduino Nano with the RDM8800 to read data from NFC tags. After soldering wires between the Nano and the RDM8800, I attempted to test these devices using code similar to what has been used successfully on other serial devices similar to the RDM8800. Below is the code I used to test.

Wiring:

Nano - RDM8800
--------------
 5V  -  5V
GND  -  GND
 D3  -  TX
 D2  -  RX

Tags Tested:

NTAG 216 (ISO14443A)
MiFare Classic 1k (ISO14443A)

Code:

#include <SoftwareSerial.h>

SoftwareSerial soft(2,3);

void setup() {
  soft.begin(9600);
  Serial.begin(9600);
}

void loop() {
  if(soft.available() > 0) {
    String serialData = soft.readString();
    Serial.println(serialData);
    writeAck();
  }

}

void writeAck() {
  uint8_t payload[] = "ACK|0|\n";
  soft.write(payload, sizeof(payload));
}

I watched the serial monitor and attempted to scan two different NFC tags that matched the ISO14443A compatibility that should ship with the RDM8800, according to this article. I got no information returned on the serial monitor.

After, assuming the issue is with the firmware, I attempted to upload the firmware to the RDM8800, with no success. I installed the needed board support to the Arduino IDE, as outlined in the intro article. Not having a USB to serial tool, I used another Nano and simply bridged the connection between the GND and RST pins. I was unable to upload the firmware to the RDM8800, getting the error below each time I tried.

Error:

avrdude: stk500_recv(): programmer is not responding

I believe that it's possible that I can't upload the firmware to the RDM8800 because the setup I used with the Nano as the USB to serial tool lacked a reset button. The image in the intro article, says to connect the TX RX GND 5V and RST pins, but the image that it says shows this only shows the TX RX GND and 5V pins connected(See below).

Image:

The information that I've found on the RDM8800 and its use is very limited and so is my knowledge on this topic. I'm unsure how I should proceed right now. I believe that I'm taking the right approach to setup code to scan NFC tags, but I could be wrong there. I'm very unsure on what I'm doing in relation to the potential firmware issue. Overall, I'm simply unsure on how to proceed and I'm looking for more knowledgeable people to give me some advice on how to proceed.

Relevant Resources:
RDM8800 Itead Wiki Page
RDM8800 Data Sheet
RDM8800 Schematic
RDM8800 Introduction Article


texts: does EEPROM.write() only writes changed data?

texts:
Do I understand the code in EEPROM.cpp / write() correctly, that val is only written to the EEPROM, if val differs from the current EEPROM contents at the given address?

And if the answer is yes, what is commit() doing?


texts: How to burn arduino bootloader on SAMD21 chips using J-Link mini

texts:
I am planning on making my own custom PCB of a SAMD21 board. I would like to ask if anyone has experience uploading arduino bootloader on a J-link Mini although adafruit has a guide on this device, its not uploading a arduino bootloader.

On a related note which pins should I connect it to my SAMD21 chip ?


texts: Help with sending data to MIT app inventor through bluetooth

texts:
I'm trying to connect my arduino bluetooth sensor to an MIT App Inventor app I made, and in doing so display the readings of two of my sensors. Whenever I test the sensors in the serial monitor, I get normal readings, but sending them to MIT APP Inventor makes them glitch out and give me the error "Select list item: Attempt to get item number 2 of a list of length 1". I've reviewed all of my code for both the Arduino and the MIT App Inventor, and I haven't been able to find anything that may be hindering me. The timer interval for the MIT App inventor code is correct.

My Arduino code is below; the MIT app inventor code is shown in the above image

#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.
#include <PulseSensorPlayground.h>     // Includes the PulseSensorPlayground Library.

//  Variables
const int PulseWire = A1;       // PulseSensor PURPLE WIRE connected to ANALOG PIN A1
int Threshold = 550;           // Determine which Signal to "count as a beat" and which to ignore.
                               // Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
                               // Otherwise leave the default "550" value.
const int PIEZO_PIN = A0; // Piezo output

PulseSensorPlayground pulseSensor;  // Creates an instance of the PulseSensorPlayground object called "pulseSensor"

void setup() {
  Serial.begin(9600);          // For Serial Monitor
  // Configure the PulseSensor object, by assigning our variables to it.
  pulseSensor.analogInput(PulseWire);
  pulseSensor.setThreshold(Threshold);
  }
void loop() {
  int piezoADC = analogRead(PIEZO_PIN); //Get the analog value of the Piezo sensor
  float piezoV = (piezoADC / 1023.0 * 5.0);  //Get the voltage of the Piezo sensor
  int myBPM = pulseSensor.getBeatsPerMinute(); //Get the BPM detected of the user

  Serial.print((double)piezoV); // Print Piezo voltage

  Serial.print("|"); //Use this character to separate the vibration from the heartbeat

  if (pulseSensor.getBeatsPerMinute() == 0){
  Serial.println("N/A");
 }
 else{
  Serial.println((int)myBPM); //Print the BPM
 }
  delay(5000);

}


texts:
I am trying to use DHT11 sensor with Arduino. But unfortunately it is returning following values:

Temperature = 1.00
Humidity = 2.00

My code is as follows:

#include <dht.h>
dht DHT;
#define DHT11_PIN 7

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

void loop()
{
    int chk = DHT.read11(DHT11_PIN);
    Serial.print("Temperature = ");
    Serial.println(DHT.temperature);
    Serial.print("Humidity = ");
    Serial.println(DHT.humidity);
    delay(1000);
}

Link to the library I am using is here

I have connected +ve to 3.3 V
I have connected -ve to Ground
I have connected out to digital pin # 7


texts:
I am using an arduino nano with the standard arduino IR remote library. For now I am using the Irrecord sketch. However, I want to have some pre - programed codes for remotes I don't have. I found this site which apparently has the hex of an endless number of remotes. When I use the regular IR decode, the hex of any remote I use, is only a couple of characters.  However at this site the typical amount is at least 100.

This is the hex for a Toshiba model's sleep command:

0000 006c 0022 0002 0157 00ab 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0040 0016 0016 0016 0040 0016 0040 0016 0040 0016 0040 0016 0040 0016 0040 0016 0016 0016 0040 0016 0040 0016 0016 0016 0040 0016 0016 0016 0040 0016 0016 0016 0016 0016 0016 0016 0016 0016 0040 0016 0016 0016 0040 0016 0016 0016 0040 0016 0040 0016 0040 0016 05f0 0157 0055 0016 0e52

So, finally after all that if you are still with me my question is, how would I send that command with the IRRemote library.


texts: I using the above mentioned GPS module with Arduino UNO. I find that I cannot receive the Latitude and Longitude values in the $GPRMC string in the NMEA data, as I used the module inside a concrete building. I got the values when I placed the module just outside the window. But I have noticed that the phones we use can get the location data just fine through their in-built GPS after waiting for just some time. How is this possible? Any way I can achieve this using the Ublox Neo 6M module?


texts:
I don't write a lot of C, so I'm always discovering things I only partly understand in the Arduino variety. One of these is how Serial.print handles char[].

Does Serial.print always require a null terminator? In the case of (say) Serial.print(88, DEC); is a null implied?

What happens in the following cases?

char buff[3] = "ABC"; // warned because no room for a null
Serial.print(buff);   // will absence of a null cause overrun?

char buff[4] = "ABC"; // now there's a null
Serial.print(buff);   // will the null character be sent too?

Any references appreciated.


texts:
I'm trying to make a bluetooth mouse using Arduino. I will be using an analog 2 axis thumbstick as the sensor. I understand that it's possible to do this with the Arduino connected directly to the computer (https://www.arduino.cc/reference/en/language/functions/usb/mouse/). Would it be possible for the arduino to instead communicate wirelessly using bluetooth? The controller I'm interested in is here: https://www.dfrobot.com/product-1259.html

Thank you!


texts: GPS timestamping of digitized voltages from geophones

texts: I wonder if anyone has written a code for GPS time stamping of voltages from seismic geophone (or any other sensors) digitized by internal or better external ADC connected to Arduino? Since the accuracy of at least 1 millisecond is required I believe using 1 PPS signal of the GPS is the only solution.


texts:
Sorry if there is an obvious answer to this - I'm pretty new at Arduino and electronics. I've searched a bunch, but I think I'm too vague - and don't know what terms to look for.

I have a pretty simple project using a 3.3v Arduino Pro Mini (https://www.adafruit.com/products/2377) and a 12v button/LED (https://www.adafruit.com/products/1185).

I'd like to give the LED the full 12v so the light is a bright as possible. The system will be battery operated.

The question is: Do I need a 12v power supply or can I use a 3.7v power supply and upgrade it somehow? I know I can power the LED with 3.7v but then it's really dim. Is there a way to "upgrade" the 3.7v to 12v? I would assume this would draw more power and drain the battery faster, but I think that would be ok.

I'm hoping to get away with a 3.7v power supply because I want to use a lithium ion polymer battery (https://www.adafruit.com/products/328) - since it's small and rechargeable.

Seems like if I go with 12v source then I need a much bigger battery pack, and I'm hoping to keep the project small. Not sure if it would help to know, but I only need the device to run for 4+ hours between charges.

I'm guessing people will say to go with 12v since the Pro Mini can downgrade the 12v supply so there'd be less parts I have to deal with (I can already make this work). But, again, I was hoping to get away with a small rechargeable power supply. Or, are there good, small 12v batteries - I can't seem to find any on Adafruit or SparkFun.

Any recommendations? Thanks!


texts: Is it possible to access a RTC variable from outside a Lib

texts:
Inside my .cpp file of myESP32sleep library I have a few RTC_DATA_ATTR variables defined OUTSIDE esp32Sleep class ( this is the only way to define them ).
How can I access bootCounter outside that file ( when using an instance of class ) ?
#include "Arduino.h"
#include "myESP32sleep.h"

#define drift_ArraySize 3
#define zeroval 999.0

RTC_DATA_ATTR long clock_expectedWake = 0;
RTC_DATA_ATTR int bootCounter = 0;
RTC_DATA_ATTR float driftRTC = 0;
RTC_DATA_ATTR long clock_beforeSleep = 0;
RTC_DATA_ATTR float driftsArray_RTC[drift_ArraySize];

// ~~~~~~~~ Start ~~~~~~~~~
esp32Sleep::esp32Sleep(int deepsleep, int forcedwake, char *devname)

Edit 1 - using Juraj's comment:
inside .h file:
#ifndef myESP32sleep_h
#define myESP32sleep_h

#include "Arduino.h"
#include "EEPROM.h"
#include "secrets.h"

extern int bootCounter; //RTC var

class esp32Sleep
{


texts: ATTiny85 Digispark clones failing USB handshake - how to program them?

texts:
I've recently bought a batch of ATTiny85 modules (Digispark clones) from China, and tried to write a first test program into them now. I noticed that they do seem to have some bootloader already installed since the P1 LED is flashing, but they do not seem to make any reasonable USB handshake.
(I have ordered other seemingly identical modules from a different seller on Ali before and was able to use them just fine.. so I generally know how to work with these.)

Linux dmesg shows me that a device was plugged in, but does not get any vendor or model ID. Windows tells me that 'the device last plugged in has failed enumeration'. This looks to me like the bootloader is incomplete or somehow broken.

So, as a next step, I tried to rewrite the AVR with an USBASP adapter over ISP, only to find out that the /reset pin apparently has been disabled via fuse bit.

I'm in some kind of a loop now... If the bootloader doesn't speak USB correctly, I can't use the Arduino IDE or avrdude or anything to write to it, and if the /reset is remapped I can't replace the bootloader via ISP to get USB working.

Can anyone provide a hint on how I can get these modules to work? Or should I just assume I bought a bad batch, throw them away and order fresh ones?


texts:
int mamank=13;
void setup() {
  pinMode (mamank,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  if(sensorValue>550)digitalWrite(mamank,HIGH);
  else if(sensorValue<500)digitalWrite(mamank,LOW);
  delay(100);
}

-----------------------------------------------AND this code----------------------

int red=2;
int green=3;
int blue=4;

void setup () {
  pinMode (red,OUTPUT);
  pinMode (green,OUTPUT);
  pinMode (blue,OUTPUT);
  Serial.begin (9600);}

void loop() {
  // read the input on analog pin 0:
  int value = analogRead(A1);

  if (value > 500) {
    Serial.println("Very heavy Rain");
    digitalWrite (red,HIGH);
    digitalWrite(green,LOW);
    digitalWrite(blue,LOW);}
  else if ((value > 300) && (value <= 500)) {
    Serial.println("AVERAGE Rain");
    digitalWrite (green,HIGH);
    digitalWrite (red,LOW);
    }
  else{
    Serial.println("Dry Weather");
    digitalWrite (blue,HIGH);
    digitalWrite (red,LOW);
    digitalWrite (green,LOW);
  delay(100);
  }
  }


texts: Uploading .hex to ATTiny13 using Arduino

texts:
I would like to upload a .hex to ATTiny13V (or '13A) using Arduino Uno R3.
I think I know everything to do, but ATTiny13 ISP support and Arduino IDE is a bit search-and-find, and I have some grey-areas in my understanding of how this all works together.

I got here by:

-Finding an Instructable that did something I liked, and there's a ATTiny13V used, a .hex to upload, and C source if I want to modify the source.  Right now I do not need to modify the source, the available .hex is fine.

-I then looked for a way to have AVR programing from OS X.  This seems a little problem, many AVR programmer hardware work great under Windows but seem to have mixed results under OS X.  I saw Arduino could be used for this under OS X.

-I looked on local craigslist for Arduino, someone was selling a Uno R3 with some extras for a great price, and here we are.   And now I have a lot more projects I wish to complete!

I am using Arduino 1.6.10 (from the .cc not the .org).

I read on stackexchange and other places that smeezekitty's core13 works for the ATTiny13.
elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/

That's great, but: If I am not using any of the Arduino-specific commands, I don't think I need the bootloader, correct?  I think it is not really a bootloader but builds support for some of the Arduino-specific higher-level commands used by sketch files.

Do I even need the ATTiny13 core files if I hook the pins up properly between the '13 on a breadboard and the Arduino (as per here:  https://create.arduino.cc/projecthub/arjun/programming-attiny85-with-arduino-uno-afb829 ).

I really do not understand what the Arduino IDE/bootloader is doing for me as an abstraction layer.  Do I need the bootloader if I'm not using any of the higher-level Arduino-specific commands on the chip?  HOw about the core files for ATTinyanything vs specifically ATTiny13?

The hex file and C source I will be using are here:
http://www.instructables.com/id/Programmable-LED/
My nextstep will be to modify the source. The C source looks like it references some AVR-specific header files.  I see that the ArduinoIDE uses avrdude so maybe things will compile anyway?

I feel like I'm close but not 100% in my understanding of what I need to do, with the tools I have on hand.

Thanks for your help- I am not above a step-by-step.

Main question 1:  I have a .hex file, an Arduino and IDE 1.6.10, OS X, and breadboard and useful components.  What do I need to do to put the hex on this ATTiny13?

Main question 2: Jumping-off points for taking the C source I linked, tweaking it a bit, building a hex, and uploading that.  I am not against moving it to a sketch if I have to, but it would be good for me to learn how this works before I mode to the IDE.

I have a small software background, am comfortable taking that C source and making changes and compiling (assuming I can find the needed .h files), but this is my first time working with any multiprocessors.


texts: How to power up this LCD 7 segments display

texts:
I got two of these type of 7 segments display in LCD material.

And here is the datasheet

I tried to power up to UNO, it can make the segment on, while a second, the segment go off, but the pinMode does not changed.


texts: How to Set RTC in ES32 using NTP server?

texts: I am working on ESP32 And want to set RTC from the NTP server. How can I get epoch value I have done this thing on CC3200 launchpad and used an NTP server library to obtain epoch value.


texts:
I'm getting the error:

    left_hand:3:20: error: expected ']' before ';' token
     #define HAND_ROWS 5;
                        ^

on this code:

    #include <Keyboard.h>

    #define HAND_ROWS 5;
    #define HAND_COLS 6;
    #define ROW_PINS {9, 8, 7, 6, 5};
    #define COL_PINS {10, 16, 14, 15, 18, 19};
    #define LOOP_SPEED = 10;

    const char keymap[HAND_ROWS][HAND_COLS] = {{0xB1, '1', '2', '3', '4', '5'},
                                               {0xB3, 0x81, 'q', 'w', 'e', 'r'},
                                               {'6', 0x80, 'a', 's', 'd', 'f'},
                                               {'7', 'z', 'x', 'c', 'v', 'b'},
                                               {'h', 'j', 0x82, ' ', 'k', 'l'}};
    boolean pressedKeys;
    int keymapIndex;

help, please? This makes no sense to me...
If I try to use Keyboard.LEFT_SHIFT and equivalent constants for the hex-codes in the keymap, they tell me 'expected unqualified-id before numerical constant'
What does this even mean? I'm so lost...


texts:
I connected corresponding pins of Arduino Nano and the Ethernet Shield, connected my computer to a router (the light indicated the connection) and Ethernet Shield to the same router. Nevertheless, there is no sign of connection on the router and the leds on the Shield don't light up either. I tried changing cables and Shields, but this didn't work. Here is my code example. What could be wrong?
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192, 168, 1, 3};
byte myDns[] = {192, 168, 1, 1};
byte gateway[] = {192, 168, 1, 1};
byte subnet[] = {255, 255, 255, 0};

EthernetServer server = EthernetServer(23);

void setup() {
// initialize the ethernet device
  Ethernet.begin(mac, ip, myDns, gateway, subnet);
  // start listening for clients
  server.begin();

  Serial.begin(9600);
  Serial.println(Ethernet.localIP());
  Serial.end();
}


texts:
Firstly, I know that I have already posted this. I do not think anyone here is stupid so:
The game is: a power source connected to 6 buttons connected to 6 LEDs. you press them all in the randomly generated order, and they blink in the order pressed after completion, then randomize and reset.

I have an array shuffler code  1)Does the array shuffler work 2)How do I configure ports and attach them to values in the array, 3) How do I use an if-then statement to say if all buttons pressed in order, then LEDs blink 3 times?  I have a picture but not the actual Arduino, so, upon request, I can post the picture. Thank you. code:

void setup() {
    // put your setup code here, to run once:
}

void loop() {
    // put your main code here, to run repeatedly:
    int questionNumberArray[] = {0,1,2,3,4,5,6};//the array itself
    const size_t n = sizeof(questionNumberArray) / //the array used
    sizeof(questionNumberArray[0]);//the base of the array

    for (size_t i = 0; i < n - 1; i++) //the loop itself
    {
        size_t j = random(1, n - i);
        int t = questionNumberArray[i]; //integer output for increase
        questionNumberArray[i] = questionNumberArray[j];//the value definition
        questionNumberArray[j] = t;
    }

}

The six buttons are connected to digital pins (1, 2, 9, 11, 12, 13)


texts: Arduino Timer 0 in fast PWM mode and micros()

texts:
I have the same problem as described on this topic

I needed to set my prescale factor for Timer0 to 1 so I can get a 62.5Khz PWM out of pin 4

My issue is that now the delays() function on my sketches doesn't work correctly.
As mentioned also in the above topic, I've changed the MICROSECONDS_PER_TIMER0_OVERFLOW macro on the wiring.c library, but this doesn't fix the delay() function.

I understand I need to fix the micros() function as well, however I'm confused on how to address the problem.

Isn't the Timer0 Interrupt overflowing 64 times faster now?
So dividing the micros by 64 shouldn't address the problem


texts:
I have this code written and functioning that will write out the chars in cmd to a serial port for an input of ASCII text representing byte values.

void SendCTRL (String &input)
{
  //Adjust Data
  const char *hin = input.c_str();    // Get character array
  int clen = input.length()/2;
  unsigned char cmd[clen+1]; // Leave a byte for null terminator
  for (int i=0; i < 2*clen; i+=2)
  {
    cmd[i/2] = dehex(hin[i])<<4 | dehex(hin[i+1]);
  }

  //Send Data
  cmd[clen] = 0;                     // Null-byte terminator
  digitalWrite(SSerialTxControl, RS485Transmit);  // Enable RS485 Transmit
  for (int i=0; i< clen; i++)
  {
    RS485Serial.write(cmd[i]);   // Send string someplace
  }
  digitalWrite(SSerialTxControl, RS485Receive);  // Disable RS485 Transmit
}

As the majority of the byte values fed are constant, I'm trying to create similar output for the following code when I feed the function below only the byte values that change frequently:

void Create_Message(int Address, int Data)
{
  //Adjust Data
  Address--;
  byte SvAdd = 1;
  byte FuCode = 6;
  byte AddHi = Address>>8;
  byte AddLo = Address;
  byte DatHi = Data>>8;
  byte DatLo = Data;
  byte AdDa[] = {SvAdd,FuCode,AddHi,AddLo,DatHi,DatLo};
  unsigned int crc=CRC(AdDa,sizeof(AdDa)/sizeof(AdDa[0]));
  byte CrcHi = crc & 0xFF;
  byte CrcLo = crc >> 8;
  /*U8 Slave Address, U8, Function Code, U16 Address, U16 Data, U16 CRC
  * to
  *[U8 Address Split High, U8 Address Split Low, U8 Data Split High, U8 Data Split Low, U8 Function Code]
  */

  //Send Data
  unsigned char cmd[9]={SvAdd,FuCode,AddHi,AddLo,DatHi,DatLo,CrcHi,CrcLo};
  cmd[8]=0; //Null-byte terminator
  digitalWrite(SSerialTxControl, RS485Transmit);  // Enable RS485 Transmit
  lcd.setCursor(0, 1);
  for (int i=0; i< sizeof(cmd)/sizeof(cmd[0]); i++)
  {
    RS485Serial.write(cmd[i]);   // Send string someplace
  }
  digitalWrite(SSerialTxControl, RS485Receive);  // Disable RS485 Transmit
}

I'm reading the Values written by RS485.write() and, in both cases, the data is good. However, for the 2nd section of code, the Arduino seems to write out the null-byte while it does not write the byte out in the 1st block. If I remove the allocation for the null-byte in the second code, it does not get a response from my device.

I'm guessing that the issue is that I am not setting my null-byte terminator correctly or otherwise missing something (I'm pretty new here XD )

Update: it seems like using sizeof(cmd)/sizeof(cmd[0]) to determine the send length interfered with data transmission when I set this to a constant the code works just fine.


texts: Adafruit OLED 7 Pin Display - Abbreviations

texts:
I can't remember for the life of me how exactly I set up this screen in previous models, partially because the references I'm using in my code have different names from the pins on the Adafruit display.
My code identifies the following digital pins for the following display pins:
OLED_MOSI = 12
OLED_CLK = 11
OLED_DC = 10
OLED_CS = 8
OLED_RESET = 9

My Arduino is then attached from the following pins to those labelled on the OLED display as"
12 -> SDA
11 -> SCK
10 -> DC
8 -> CS
9 -> RES
5V -> VDD
GND -> GND

In other words, I am interpreting the following as being equivalent:
RES = RESET
SCK = SCK
MOSI = SDA

Is there anything within the information I've provided that is wrong / may cause the screen to malfunction?
Thank you very much in advance.


texts: Analog angle conversion from +70° to -70°

texts:
I am using below sensor (accelerometer) .My application is a solar tracker, where I wanted to convert the sensor output into +70° to -70° format.

My question is how can I convert the angle?

#define ADC_ref 2.56
#define zero_x 1.569
#define zero_y 1.569
#define zero_z 1.569
#define sensitivity_x 0.3
#define sensitivity_y 0.3
#define sensitivity_z 0.3

unsigned int value_x;
unsigned int value_y;
unsigned int value_z;

float xv;
float yv;
float zv;

float angle_x;
float angle_y;
float angle_z;

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

void loop() {
  value_x = analogRead(A0);

//  value_y = analogRead(A1);
  //value_z = analogRead(A2);

  Serial.print("voltage  of x");
  Serial.println(value_x);
  /*Serial.print("voltage  of y");
   Serial.println(value_y);
   Serial.print("voltage  of z");
   Serial.println(value_z);
   */
  //xv=(value_x/1024.0*2.5)/sensitivity_x;
/*  zv=(value_z/1024.0*ADC_ref-zero_z)/sensitivity_z;
  yv=(value_y/1024.0*ADC_ref-zero_y)/sensitivity_y;
  xv=(0.0032226562499999998*value_x)/sensitivity_x;
  angle_x =atan2(-yv,-zv)*57.2957795+90;

  Serial.print ("x= ");
  Serial.println (xv);
  Serial.print("x_degree= ");
  Serial.print(angle_x);
  Serial.println(" deg");

  /*Serial.print(" g ");

   Serial.print ("y= ");
   Serial.print (yv);
   Serial.print(" g ");

   Serial.print ("z= ");
   Serial.print (zv);
   Serial.print(" g ");

   Serial.print("\n");

   Serial.print("Rotation ");

   Serial.print("x= ");

   angle_x =atan2(-yv,-zv)*57.2957795+180;

   Serial.print(angle_x);
   Serial.print(" deg");
   Serial.print(" ");

   Serial.print("y= ");

   angle_y =atan2(-xv,-zv)*57.2957795+180;

   Serial.print(angle_y);
   Serial.print(" deg");
   Serial.print(" ");

   Serial.print("z= ");

   angle_z =atan2(-yv,-xv)*57.2957795+180;

   Serial.print(angle_z);
   Serial.print(" deg");
   Serial.print("\n");
   */
  delay(1000);
  //delay(1000);
}

Description
Datasheet of ADXL335

I have inclinometer off the shelf its Vout is 0~5 V and angle measure from -70° to 70°, and I calculated as below.

void calcPos()
{
  Sensor_Value=analogRead(A3);
  voltage = Sensor_Value * ARDUINO_ANALOG_SCALING;
  tracker_actual_pos=(30*voltage)-75;
}


texts: How can I update global variable within a loop from outside the loop?

texts:
I have this code, but its not working. If I type "ReportFRQ 1" (or 0) it reports back that FrqON variable has changed but the behaviour of the loop doesnt. Basically I am trying to switch parts of the loop on and off using variables, which are updated by serial command.

The main body of the code was kindly provided by another answer as a way of commanding the arduino remotely with custom commands. I can get the arduino to do various things, but updating the behaviour of the loop by activating and deactivating different variables does not seem to work...

Any ideas? Thanks

#include <avr/pgmspace.h>
#include <FreqCounter.h>

#define BUF_LENGTH 128  /* Buffer for the incoming command. */

unsigned long int frq;
unsigned int frqON;

static bool do_echo = true;

/* Execute a complete command. */
static void exec(char *cmdline)
{
char *command = strsep(&cmdline, " ");

if (strcmp_P(command, PSTR("help")) == 0) {
    Serial.println(F(
        "echo <value>: set echo off (0) or on (1)\r\n"
        "freq: reports current frequency"
        ));
} else if (strcmp_P(command, PSTR("echo")) == 0) {
    do_echo = atoi(cmdline);
} else if (strcmp_P(command, PSTR("freq")) == 0) {
       FreqCounter::f_comp= 8 ;             // Set compensation to 12
       FreqCounter::start(10);            // Start counting with gatetime of 100ms
       while (FreqCounter::f_ready == 0)         // wait until counter ready
       frq=FreqCounter::f_freq;            // read result
       if (frq<1) Serial.println("OFF");
       if (frq>1) Serial.println(frq);
} else if (strcmp_P(command, PSTR("ReportFRQ")) == 0) {
       int frqON = atoi(strsep(&cmdline, " "));
       Serial.println(frqON);

} else {
    Serial.print(F("Error: Unknown command: "));
    Serial.println(command);
 }
 }

 void setup()
 {
Serial.begin(57600);
Serial.println("Frequency Counter");
}

void loop() {

/* Process incoming commands. */
while (Serial.available()) {
    static char buffer[BUF_LENGTH];
    static int length = 0;

    int data = Serial.read();
    if (do_echo) Serial.write(data);
    if ((data == '\b' || data == '\177') && length) {  // BS and DEL
        length--;
        if (data == '\177') Serial.write('\b');
        Serial.write(" \b");
    }
    else if (data == '\r') {
        if (do_echo) Serial.write('\n');    // output CRLF
        buffer[length] = '\0';
        if (length) exec(buffer);
        length = 0;
    }
    else if (length < BUF_LENGTH - 1)
        buffer[length++] = data;
 }

 if (frqON = 1) {
        frq=FreqCounter::f_freq;            // read result
       if (frq<1) Serial.println("OFF");
       if (frq>1) Serial.println(frq);
 }

    /* Whatever else needs to be done... */
 }


texts: Can a motherboard be a simple circuit between arduino uno and a set of devices (ie: motors)

texts:
Reason for question:
My son is working on a project to build a robot controlled by an arduino uno. This question is more about terminology than process, but since terms are very important at this level, I rather ask some expert advice - I have not found any input on the internet about this!

Question:
What is the correct technical name (if any) of the circuit board that acts as the interface between the arduino-uno (a micro-controller) and the motors (the external devices)? According to the definition of a motherboard*, this "interface" circuit board would act as a very basic motherboard, as it would "allow communication" between the components, but it would not contain expansion slots, so should it be called something else?

Background on project:
The robot will be very basic. A body will be made of plastic legs and motors for joints; an Arduino-uno will provide the logic for motor movement; and a custom circuit board (hence my question) will act as the interface between the uno and the motors, providing electricity from a dedicated source to the motors.

We are just missing the proper terminology to use for this "interface" board and I cannot find any concrete info online or on books. If I get good terms in this post, then we can do further research on those terms. Thanks.

https://en.wikipedia.org/wiki/Motherboard


texts: ESP8266 does not respond after changing baud rate to 9600

texts:
I have ESP8266 WiFi module and Arduino Mega Board connected. I use external 5 to 3.3 V regulator to power up the module. Common (-ve) line on the external power source and Arduino Mega GND is connected. Then I used 1K and 2K voltage divider for WiFi module RX and TX use as same. I am sure my circuit is well works.

Then I connect RX0-RX and TX0-TX. Then i put CH-PD to 3.3v

Then I opened the Arduino IDE and upload the Blink sketch. Done.. Then I opened Serial Monitor and set baud rate to 115200. Then power up the module. It gave me a lots of garbage values and ready. Fine.

Then I downloaded the FLASH_DOWNLOAD_TOOLS_v0.9.5. configure the 0x0000, 0x1000 and 0x7c000

SPI speed = 40MHZ
SPI mode = QIO
FLASH size = 4Mbit
0x1000 = ai-thinker-0.9.5.2-9600.bin

Then O power off the module and connect GPIO0 to ground and again power on.

Then push start button. Then it downloaded to the chip. It worked. Done. Success fully uploaded. Then I again disconnected the GPIO0 and power on. Then I put AT and it results OK.

AT+GMR gives version 0.9.5 updated.done.

The problem was the module was responded for 115200 baud rate, not 9600. Then I:

AT+IPR=9600

it gives me nothing.

Now I can't communicate with it at either 115200 or 9600 baud. No respond whatever baud rate I put. Sometimes I am having same garbage values.


texts: Uno Wifi Rev2 Programming via Uno R3 ArduinoISP

texts:
I'm attempting to program Atmega4809 (Uno Wifi Rev2) via the ICSP pins on the board by connecting in this manner:
The difference is that I have a Uno Wifi Rev2 on the right instead of a Uno R3. I've uploaded the ArduinoISP sketch onto the Uno R3 on the left. Here is the avrdude command that I am using:
$ avrdude -v -patmega4809 -cavrisp -P /dev/ttyACM1 -b19200 -U program.elf

...

avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude: error reading signature data for part "ATmega4809", rc=-2
avrdude: error reading signature data, rc=-2

Full log: https://pastebin.com/LUfhsYeD
I am wondering if I am missing some difference between the UnoR3 and Uno Wifi Rev2... there doesn't seem to be much documentation about external programming of the Uno Wifi Rev2's Atmega 4809.
If it helps, my usecase for trying to program my Uno Wifi Rev2 externally is a need to reprogram the 32u4 as a HID. Once I program the 32u4, I won't be able to program the 4809 via USB (afaik).
If anyone knows what I'm doing wrong or the proper way to program the Uno Wifi Rev2 externally, your help would be greatly appreciated.


texts: Which Arduino DC motor controller shield to use?

texts:
I wanted to try and experiment on 24 V DC motors (Dual) and was looking for controllers compatible with Arduino Uno.

When I found this Pololu TReX Jr 2 x 2.5A 5-24V Dual Motor Controller, the specifications state that:

• Dual motor controller - 2.5A 5-24V
• Analog voltage, RC, Serial (TTL/RS-232) interfaces
• Safety features ("Safe-start", motor shutdown on error)
• Weight: 14g

Normally looking at other forums what I found out was that because a fully charged 24 V battery can provide more than 24 V to control a 24 V motor with a 24 V battery I must use a controller whose specification higher range is higher than 24 V is this correct?
What exactly to look for when buying a controller like this one?


texts: How to measure CO2, Ammonia and Detect Smoke using MQ135?

texts:
Setup Info:

MQ135 + Arduino+16x2LCD+ESP8266+ThinkSpeak.

Hi All, I have just bought a MQ135 . I started arduino basics with LED blinking , interfacing and then started with my real project.
e
I have seen in the data sheet of MQ135 that it can measure Ammonia, Sulfide,CO2 and Benze steam. It can also be used to detect smoke and alert.

But in the Arduino uno Serial monitor, I can see only one value 408.

Now, I dont know how to differentiate it in all different values of required gases and trigger smoke alarm

Also, my friend suggested to calibrate this sensor for which I found really good material and started with 24 Hours on test after dumping a code to read data from it.
Now I read 1836 which was 1795 , about half an hour back.

Kindly reply and let me know what info or input is required from My side.
This is my first of my many uno projects to come.

Regards,
Sillicon
https://forum.arduino.cc/index.php?topic=535401.msg3649205#msg3649205


texts: Why the LED freezes? when I am adding a delay?

texts:
I am new into arduino and stuff. So i was playing around with the pull up resistor. It worked fine but the problem rised when I used a delay to turn the led on for few seconds before it gets back to low state it stopped working when I pressed the switch multiple times it may work sometimes but maximum time it is not working

here is the code

const int buttonPin = 4;
const int ledPin =  12;
int buttonState = 0;

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

void loop() {
        buttonState = digitalRead(buttonPin);
      if (buttonState == LOW)
  {
    digitalWrite(ledPin, HIGH);
    delay(5000);
  } else
  {
    digitalWrite(ledPin, LOW);
    delay(5000);
  }
}


texts: How to declare and use "Variabled arrays" inside arrays

texts:
Good day folks. I'm new here and have been starting to be enthusiast in Arduino. I have a problem and I don't know what I should do, or whether I did something wrong regarding an array of arrays. Surfed on the internet to find a bunch of examples but the only difference is that they don't use arrays that have been declared to have a name inside array.
Every array inside array I see that works is like this:
byte array[2][4] = { {1,2,3,4}, {5,6,7,8} };
Serial.println(array[0][2]); is equal to '3'.

But mine is like this:
byte arrayX[4] = {1,2,3,4};
byte arrayY[4] = {5,6,7,8};

byte arrayZ[2][4] = { arrayX[4], arrayY[4] };

Serial.println(arrayX[2]); is equals to '3'.
Serial.println(arrayZ[0][2]); is equal to '0'.

Why?
Below is what in reality I am experiencing. I hope someone can try this out too.
softAddr = cycle * 2;

is an expression I used for looping where cycle is the iterated variable
for (byte cycle = 0; cycle < 7; cycle++) {}

I did a simple simulation and I guess the way I initialize the parent array, it initializes a new array in the name same from the declared variables but separate.
byte arrayX[4] = {1,2,3,4};
byte arrayY[4] = {5,6,7,8};

void setup() {
  Serial.begin(9600);
  byte glass[2][4] = {arrayX[4], arrayY[4]};
  Serial.print(F("OLD 1: ")); Serial.println(arrayX[0]);
  Serial.print(F("OLD 2: ")); Serial.println(arrayX[1]);
  Serial.print(F("NEW 1: ")); Serial.println(`glass[0][0]`);
  Serial.print(F("NEW 2: ")); Serial.println(`glass[0][1]`);
}

output:

OLD 1: 1
OLD 2: 2
NEW 1: 0
NEW 2: 0

//answered realized
I forgot that the array I put inside the array already had its data based on its index and the [4] resulted to nothing or 0 since there is no value at index [4] (knowing, indexes where 0, 1, 2, 3 on a 4 sized array). I realized this after I made a simple loop declaration not instantly like this:
byte arrayZ[2][4] = { arrayX[1], arrayY[1] };

But like this:
byte arrayX[4] = {10,11,12,13};
byte arrayY[4] = {20,21,22,23};
byte arrayZ[2][4];
void setup() {
  Serial.begin(9600);
  for (byte parent = 0; parent < 2; parent++) {
    for (byte child = 0; child < 4; child++) {
      if (parent == 0) {
        arrayZ[parent][child] = arrayX[child];
      } else {
        arrayZ[parent][child] = arrayY[child];
      }
    }
  }
  for (byte parent = 0; parent < 2; parent++) {
    for (byte child = 0; child < 4; child++) {
      Serial.print(F("value: ")); Serial.println(arrayZ[parent][child]);
    }
  }
}

Output:

value: 10
value: 11
value: 12
value: 13
value: 20
value: 21
value: 22
value: 23

Resulting in simply like this:
byte arrayZ[2][4] = {
  {arrayX[0],arrayX[1],arrayX[2],arrayX[3]},
  {arrayY[0],arrayY[1],arrayY[2],arrayY[3]}
};


texts:
I have connected a RN-42 bluetooth (TX-D0, RX-D1, VCC-5V, GND_GND) to arduino.The problem is that when I run this code ,nothing happens it just upload to infinite or it doesn't. I am checking with tera term. Is there a problem with the connection of the pins? Also when I pair my android phone to the bluetooth it says paired on the phone but the blue light of the bluetooth doesn't switch on, like it's not connected.

  #include <SoftwareSerial.h>// import the serial library
   SoftwareSerial Genotronex(1, 0); // TX,RX
   int ledpin=13; // led on D13 will show blink on / off
   int BluetoothData; // the data given from Computer

  void setup() {
  // put your setup code here, to run once:
   Genotronex.begin(9600);
   Genotronex.println("Bluetooth On please press 1 or 0 blink LED ..");
   pinMode(ledpin,OUTPUT);
  }

  void loop() {
    // put your main code here, to run repeatedly:
  if (Genotronex.available()){
     BluetoothData=Genotronex.read();
   if(BluetoothData=='1'){   // if number 1 pressed ....
  digitalWrite(ledpin,1);
  Genotronex.println("LED  On D13 ON ! ");
   }
  if (BluetoothData=='0'){// if number 0 pressed ....
   digitalWrite(ledpin,0);
   Genotronex.println("LED  On D13 Off ! ");
   }
}
   delay(100);// prepare for next data ...
 }


texts: How do I set up communication between the "Seeeduino Xiao" and the "Adafruit Bluefruit LE UART Friend - Bluetooth Low Energy (BLE)"?

texts: I've seen normal Arduino boards connecting to it no problem (Uno, Nano, etc.). I'm trying to connect it to my Seeeduino Xiao. It has UART compatible pins, so I'm fairly certain wiring isn't an issue. I think I'm having a hard time with the coding.


texts: Arduino: Error: 'PubNub' was not declared in this scope

texts:
I'm new to Arduino. When Arduino verifies this sketch https://github.com/MediaTek-Labs/Real-Time-Bicycle-Tracking-Map-using-PubNub throws the following:

Build options changed, rebuilding all
BikeTracker.ino: In function 'void setup()':
BikeTracker.ino:45:5: error: 'PubNub' was not declared in this scope
BikeTracker.ino: In function 'void loop()':
BikeTracker.ino:91:14: error: 'PubNub' was not declared in this scope

I've read most answers are pointing out to www.arduino.cc/en/Guide/Libraries some people say it's common Arduino linking issue (easy to fix) after tried out multiple approaches with no dice.

I've also followed PubNub customer support advice (with list of steps below) but no avail:

  OCT 12, 2015  |  10:23AM PDT  PubNub replied: Eduardo,

  I got this from our hardware/IoT/embedded engineer:

  You are probably not including all the libraries, or has the wrong
  path for them.

  When you download the source at
  MediaTek-Labs/Real-Time-Bicycle-Tracking-Map-using-PubNub on GitHub:

  Click .ino file and a pop up will ask if you need a new folder for the
  sketch – click Yes.
  Then copy the rest of the files from the source to
  this new folder.
  Compile it and see if you get any library path errors
  that you need to provide. Let me know if you require further
  assistance.

BTW this is my PubNub.h https://gist.github.com/egomez99/fb1d738ec39913629e9a

Hope someone can shed some lights.


texts: I need really good gyroscope for my quadcopter and now I have MPU6050. I don't like how it works, after some time of use, data is absolutely wrong. So I need good gyroscope, could you pls advice the best gyroscope for Arduino?


texts: Arduino Mega Clone CH340G Capacitor Values

texts:
I'm making my own Arduino Mega board with ATmega2560-16AU and CH340G. Jump to the end of the post to find the real question.
I have already ordered a PCB before and it didn't work when I soldered everything in place. I have already asked why that board didn't work on another post here: Programming custom Arduino Mega with Arduino Uno
But I was not satisfied with the answers and started suspecting whether or not the capacitor values were right on my board.
I'm trying to make my own version of RobotDyn's Arduino Mega 2560 Pro so I tried taking the already programmed ch340g and soldering it on my own board and still failed. When I put a previously not programmed ch340g on the RobotDyn board and programmed it using Arduino UNO (Arduino as ISP) the board would work.
So now I ordered a new PCB but haven't ordered any of the passive components yet.
If any of you could tell me where I could find the values from the schematic below I would really appreciate that.
https://robotdyn.com/pub/media/0G-00005641==MEGA-PRO-CH340GATmega2560/DOCS/Schematic==0G-00005641==MEGA-PRO-CH340GATmega2560.pdf


texts:
I am doing a project that requires input from a keypad to be displayed on the LCD display.

lcd.print() displays in proper form, but when the I press characters on the keypad, they are overwritten as weird symbols.

Any help would be appreciated.

Here's the code:

void setup()
{
  Serial.begin(9600);
  Serial.println("LCD test with PWM contrast adjustment");
  pinMode(13,OUTPUT);
  analogWrite(6,Contrast);

  lcd.begin(16,2);

  pinMode(buzzer, OUTPUT);
  lcd.print(" Electronic ");
  Serial.print(" Electronic ");
  lcd.setCursor(0,1);
  lcd.print(" Keypad Lock ");
  Serial.print(" Keypad Lock ");
  delay(2000);
  lcd.clear();
  lcd.print("Enter Ur Passkey:");
  Serial.println("Enter Ur Passkey:");
  lcd.setCursor(1,0);
  for(int j=0;j<4;j++)
    EEPROM.write(j, j+49);
  for(int j=0;j<4;j++)
    pass[j]=EEPROM.read(j);
}


texts:
When trying to flash my sketch, I see many errors such as:

 ***failed;
 ***failed;
 ***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
 *** page 127 (addresses 0x7400 - 0x747f) failed to write

And also:

avrdude: error: programmer did not respond to command: set addr

How can I successfully flash my sketch?


texts:
I bought Ethernet Shield for Arduino Uno! from AliExpress. It is good work but I scanned my network with Fing and device Vendor name is null.

Can I change/set device Vendor?

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 106 };

void setup()
{
  Ethernet.begin(mac, ip);
}