texts: Adafruit Music Maker Shield - Retrieve song names from SD Card

texts:
I am currently working on a project that plays music for you. My question for this thread is, is it possible to retrieve the names of the songs within the micro SD card that is inserted into the shield?

Currently I am renaming the song files to track001, track002, track003, etc. As can be seen in the following code:

const int arraySize = 5;
char songs[arraySize][15] =
{
  {"track001.mp3"},
  {"track002.mp3"},
  {"track003.mp3"},
  {"track004.mp3"},
  {"track005.mp3"}
};

That is how am I currently playing music with this shield. I am not too happy with this as I would like to be able to insert different micro SD cards into the shield without having to rename them to track00X or without having to change the code every time to match the song names.

So, is it possible to code it to retrieve the song names from the SD card instead of having to specify their name in the code?

Below you can see my full code:

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

#define BREAKOUT_RESET  9      // VS1053 reset pin (output)
#define BREAKOUT_CS     10     // VS1053 chip select pin (output)
#define BREAKOUT_DCS    8      // VS1053 Data/command select pin (output)

#define SHIELD_CS     7      // VS1053 chip select pin (output)
#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)

#define CARDCS 4     // Card chip select pin
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);

int volume = 20;
const int arraySize = 5;
char songs[arraySize][15] =
{
  {"track001.mp3"},
  {"track002.mp3"},
  {"track003.mp3"},
  {"track004.mp3"},
  {"track005.mp3"}
};

int songNumber = 0;

void setup()
{
  Serial.begin(9600);
  musicPlayer.begin();
  SD.begin(CARDCS);
  musicPlayer.setVolume(volume, volume);
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);
}

void loop()
{
  // Lower Volume
  if (musicPlayer.GPIO_digitalRead(7) == HIGH)
  {
    if (volume < 70)
    {
      volume = volume + 1;
      musicPlayer.setVolume(volume, volume);
      delay(50);
    }
  }

  // Increase Volume
  if (musicPlayer.GPIO_digitalRead(6) == HIGH)
  {
    if (volume > 0)
    {
      volume = volume - 1;
      musicPlayer.setVolume(volume, volume);
      delay(50);
    }
  }

  // Start Music Player
  if (musicPlayer.GPIO_digitalRead(5) == HIGH)
  {
    if (! musicPlayer.playingMusic)
    {
      musicPlayer.startPlayingFile(songs[songNumber]);
    }
  }

  // Pause / Resume
  if (musicPlayer.GPIO_digitalRead(4) == HIGH)
  {
    if (! musicPlayer.paused())
    {
      musicPlayer.pausePlaying(true);
    }
    else
    {
      musicPlayer.pausePlaying(false);
    }
    delay(500);
  }

  // Prev Song
  if (musicPlayer.GPIO_digitalRead(3) == HIGH)
  {
    if (songNumber - 1 >= 0)
    {
      songNumber = songNumber - 1;
    }
    else
    {
      songNumber = arraySize - 1;
    }
    Serial.println(songNumber);
    musicPlayer.startPlayingFile(songs[songNumber]);

    delay(500);
  }

  // Next Song
  if (musicPlayer.GPIO_digitalRead(2) == HIGH)
  {
    if (songNumber + 1 < arraySize)
    {
      songNumber = songNumber + 1;
    }
    else
    {
      songNumber = 0;
    }
    Serial.println(songNumber);
    musicPlayer.startPlayingFile(songs[songNumber]);
    delay(500);
  }
}

If this is possible and someone reading this knows how to do so, I would truly appreciate it if you explained it to me and even provided an example or even edit my own code if you want. Thank you! :)


texts: Failed to read DHT22 sensor using Intel Galileo Gen2 board

texts:
Why do I end up with the display

  Failed to read from DHT sensor!

in the serial monitor in most cases when I run the code given below? When I reduce the delay to 1000ms the reading shows 0.00 for both temperature and humidity which, as well, is pretty much false. Any help would be highly appreciated.

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 2     // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Initialize DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);
// NOTE: For working with a faster chip, like an Arduino Due or Teensy, you
// might need to increase the threshold for cycle counts considered a 1 or 0.
// You can do this by passing a 3rd parameter for this threshold.  It's a bit
// of fiddling to find the right value, but in general the faster the CPU the
// higher the value.  The default for a 16mhz AVR is a value of 6.  For an
// Arduino Due that runs at 84mhz a value of 30 works.
// Example to initialize DHT sensor for Arduino Due:
//DHT dht(DHTPIN, DHTTYPE, 30);

void setup() {
  Serial.begin(9600);
  Serial.println("DHTxx test!");

  dht.begin();
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index
  // Must send in temp in Fahrenheit!
  float hi = dht.computeHeatIndex(f, h);

  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.print(" *C ");
  Serial.print(f);
  Serial.print(" *F\t");
  Serial.print("Heat index: ");
  Serial.print(hi);
  Serial.println(" *F");
}


texts: LCD shows output without pressing the sensor

texts:
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
#define vibrate_sense 7

char str[70];
char *test="$GPGGA";
char logitude[10];
char latitude[10];

int i,j,k;
int temp;
//int Ctrl+z=26;    //for sending msg
int led=13;

void setup()
{
  lcd.begin(16,2);
  Serial.begin(4800);
  pinMode(vibrate_sense, INPUT);
  pinMode(led, OUTPUT);
  lcd.setCursor(0,0);
  lcd.print("..Initializing..");
  lcd.setCursor(0,1);
    lcd.print("....System...");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
  lcd.print("Searching for");
    lcd.setCursor(0,1);
      lcd.print("Gps Signals");
  delay(2300);
lcd.clear();
  lcd.setCursor(0,0);
    lcd.print("Setup Completed");
  delay(500);
  lcd.setCursor(0,0);
    lcd.print("Accident detect");
  lcd.setCursor(0,1);
    lcd.print("& Alert system");
  delay(1500);
  lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("No accident");
        lcd.setCursor(0,1);
        lcd.print("occured");

}

void loop()
{
  if (digitalRead(vibrate_sense)==0)
  {
    for(i=18;i<27;i++)          //extract latitude from string
    {
      latitude[j]=str[i];
      j++;
    }

    for(i=30;i<40;i++)          //extract longitude from string
    {
      logitude[k]=str[i];
      k++;
    }

lcd.clear();
    lcd.setCursor(0,0);        //display latitude and longitude on 16X2 lcd display
    lcd.print("Latitude(N)");
    lcd.print(latitude);
    lcd.setCursor(0,1);
    lcd.print("Longitude(E)");
    lcd.print(logitude);
    delay(500);
    lcd.clear();
        lcd.setCursor(0,0);
    lcd.print("Accident has");
            lcd.setCursor(0,1);
    lcd.print("been Detected");
delay(500);
lcd.clear();
    lcd.print("Sending SMS");
    delay(500);
    lcd.clear();
    Serial.begin(9600);

    Serial.println("AT+CMGF=1");    //select text mode
    delay(10);
    Serial.println("AT+CMGS=\"7066128969\"");  // enter receipent number
    Serial.println("Vehicle Accident occured:");
    Serial.print("Latitude(N): ");             //enter latitude in msg
    Serial.println(latitude);                  //enter latitude value in msg
    Serial.print("Longitude(E): ");            //enter Longitude in Msg
    Serial.println(logitude);                  //enter longitude value in msg
    Serial.print("http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=");
    Serial.println(latitude);
    Serial.println("+");
    Serial.println(logitude);
    Serial.write(26);                      //send msg  Ctrl+z=26

      lcd.setCursor(0,0);
    lcd.print("SMS Sent");
delay(1000);
lcd.clear();
          lcd.setCursor(0,0);
    lcd.print("Help Please");

    temp=0;
    i=0;
    j=0;
    k=0;
    delay(20000);                        // next reading within 20 seconds
    Serial.begin(4800);
  }
}

void serialEvent()
{
  while (Serial.available())            //Serial incomming data from GPS
  {
    char inChar = (char)Serial.read();
     str[i]= inChar;                    //store incomming data from GPS to temparary string str[]
     i++;
     if (i < 7)
     {
      if(str[i-1] != test[i-1])         //check for right string
      {
        i=0;
      }
     }
    if(i >=60)
    {
     break;
    }
  }
}

This is my code for my project.
It is accident detection system and it has to work like, when I press the sensor or limit switch, it has to show a message on an LCD that an accident occurred. But it shows the message on the LCD WITHOUT pressing the sensor button.

What to do?
I think there is a mistake in my program. Can anybody please tell me where it is?


texts: Arduino Uno, BLE Bluetooth Shield and Braccio Arm Shield

texts:
I'm running the Uno board and want to connect the BLE Bluetooth shield (http://redbearlab.com/bleshield/) to control the Braccio Arm I have.

When I sit the Braccio Arm Shield on the Uno everything works - I can control the Arm.

When I sit the Bluetooth Shield on the Uno, everything works I can find the device and connect to it using the IOS App.

When I sit all 3 together, I can still control the arm but can no longer find the Bluetooth device.

Any ideas as to why this is?


texts: Need help with EEPROM not storing array values on ESP8266 after restart

texts:
I am struggling through a program. I am trying to store my uploaded string into an array then write that array to EEPROM. I run the program, upload the new array and store it in the EEPROM. all values display correctly until I reset or power off the device. I am sure I am overwriting or something obvious, but i am breaking down and asking for help.

The read and write EEPROM subroutines are at the bottom of the code. I call the EEPROM_Write() in server.on after parsing the http get.

EDIT: per feedback, removed all but the function, with the EEPROM.commit(); suggestion included... still not working

void EEPROM_Write(){
Serial.begin(115200);
EEPROM.begin(280);
  // store values in EEPROM
  for (int i = 0; i < pwmarray1Size; i++)
  {
    Serial.println(pwmarray1[i]);
    EEPROM.put( EEPROMStartAdress + (i * sizeof pwmarray1[0]), pwmarray1[i]);
  }
  Serial.println();
  EEPROM.commit();
 // EEPROM.end();
}


texts:
I've been struggling with this issue for a few days on and off now.  I made a custom PCB (schematic) for a smaller Arduino Pro Micro and it works - mostly.  The only issue I had was that the pins on the USB connector were backward, but when I soldered on a USB cable everything worked as expected.

I then made a new board (schematic) with the following changes:
 - Fix the USB connector
 - Changed two of the GPIOs that were brought out to pins (from D4 and D17 to D6 and D9)
 - Added an onboard LED connected to D8
 - Removed the jumper on HWB pin

I have been able to burn the bootloader using both an Arduino Uno and with an AVRISP mkII.  When I plug the micro into the computer the first time it is recognized as an "Arduino Micro (COM6)".  Then I try to upload the Arduino example Blink.ino sketch - and that works too.  In the process the IDE forces the reset and in device manager I can see the "Arduino Micro bootloader (COM7)" replace the micro on COM6.  The LED does begin to blink but in device manager it remains as "Arduino Micro bootloader (COM7)".  When I try to upload another sketch to this port it fails (as I would expect) because it cannot force the reset; presumably because the bootloader is already active.  So I unplug it and try again.  It shows up as "Arduino Micro (COM6); all looks good but when I try to upload it cannot force the reset, tries to upload to "Arduino Micro (COM6)" and fails (I assume because it is not entering into the bootloader).

When I double tap the reset pin or connect to the arduino using a baud rate of 1200 the micro does reset (as expected) and the light stops flashing so I suspect the bootloader is being executed - but on device manager it remains as "Arduino Micro (COM6)".

If anyone has any ideas I'm all ears.  Normally I do not have to fight with Atmel hardware like I have on this issue.


texts: ESP8266 Wifi.setOutputPower - original/default value?

texts:
I'm working on dynamically adjusting the ESP8266 WiFi power using the following function, such that it's as low as possible, yet sufficiently reliable:

WiFi.setOutputPower(x)

I've been trying unsuccessfully to find out what the original/default value is before that function is called? There is no function WiFi.getOutputPower(). I know the range of values is 0 to 20.5, but I'm curious to know what it is initially? I guess it could depend on the particular Arduino? I have the following: ESPduino, Wemos D1R2/D1R1/D1R1 mini, NodeMCU, Yun sheild.

I plan to use iwconfig & iwlist on a Pi3 to measure the RSSI, but I'd like to know the baseline if possible.

The best similar idea is expressed in here: : How to optimise TX power for ESP8266?

Thanks in advance ;-)
Geoff


texts: Custom Classes - Redefinition of void error

texts:
I'm getting a redefinition error from my classes, but can't see what I did wrong.

Error: Icon.cpp:3:6: error: redefinition of 'void Icon::setIcon(byte (*)[8])'

Can any help me out on this? Thanks!

MyFile.ino

#include "MyIcon.h"

MyIcon myIcon;

MyIcon.h

#ifndef MyIcon_h
#define MyIcon_h

#include "Arduino.h"
#include "Icon.h"

class MyIcon : public Icon {
  public:
    MyIcon();
};

#endif

MyIcon.cpp

#include "MyIcon.h"

MyIcon::MyIcon() {

  byte _icon[8][8] = {
    {1, 1, 1, 1, 1, 1, 1, 1},
    {1, 1, 2, 2, 2, 2, 1, 1},
    {1, 2, 1, 1, 1, 1, 2, 1},
    {2, 1, 2, 2, 2, 2, 1, 2},
    {1, 2, 1, 1, 1, 1, 2, 1},
    {1, 1, 1, 2, 2, 1, 1, 1},
    {1, 1, 2, 1, 1, 2, 1, 1},
    {0, 0, 0, 1, 1, 0, 0, 0},
  };
  MyIcon::setIcon(_icon);

Icon.h

#ifndef Icon_h
#define Icon_h

#include "Arduino.h"

typedef struct{
  byte r;
  byte g;
  byte b;
} RGB;

class Icon {
  public:
    Icon();
    inline virtual void setIcon(byte icon[8][8]){};
    inline virtual void setIconColors(RGB colors[3]){};
};

#endif

Icon.cpp

#include "Icon.h"

void Icon::setIcon(byte icon[8][8]) {
  __icon = icon;
}

void Icon::setIconColors(RGB colors[3]) {
  __colors = colors;
}

Edited on 09/11/18

I attempted the following changes, before I realised thanks to KIIV, that I couldn't use array like that.

My idea was to be able to getIcon() and get back the byte array, which is later used to light up specific leds on a NeoMatrix panel.

I thought I would be able to build an icon "library" by extending a base class, setting the correct byte array in the class, and using it as needed (MyIcon, MyOtherIcon, etc...)

Have I completely missed the point?

Icon.h

void setIcon(byte icon[8][8]);
void setIconColors(RGB colors[3]);

Icon.cpp

#include "Icon.h"

Icon::Icon(){ }

void Icon::setIcon(byte icon[8][8]){
  memcpy(__icon, icon, sizeof(icon));
}

void Icon::setIconColors(RGB colors[3]){
  memcpy(__colors, colors, sizeof(colors));
}


texts: What protocols and tools does Arduino Due use for flashing and debugging?

texts:
I am interested in writing a simple C program outside of the Arduino IDE and respective libraries, but deploying it directly to an Arduino Due (which uses a SAM3X8E ARM MCU). I am trying to figure out what comms/serial protocols are used for:

Flashing/deploying the program to the ARM MCU; and
Connecting the program to a debugger

And, not just the protocols used, but what tools are compatible with these protocols, and henceforth, can be used for both use cases. How can I tell what my viable options are?


texts: How to use 3 digital input pins on Arduino Uno for frequency inputs and total the output?

texts:
I am working on a Arduino tachometer that reads the RPM of a BLDC motor. The motor circuit does not use the hall sensors so I would like to use them for RPM sensors. I have already hooked up an Uno board using one pin as an input with the internal pull up enabled and it works fine.The reason I want to use all 3 hall sensors is to increase the pulse count per revolution to steady the reading on my LCD display at lower speeds.
I have been searching for information on how to read 3 inputs, and totalize the pulses for this purpose but have not been able to find the information.


texts: Arduino Nano with old bootloader flash fail

texts:
I have an arduino nano clone with Chip CH340G
I installed the latest version of the firmware, it's OK
I loaded the blink exemple and tried to flash the arduino nano
Here are my options

I connect the nano to the computer with USB only
and the flash fail with this error message:

Arduino : 1.8.12 (Windows 7), Carte : "Arduino Nano, ATmega328P (Old Bootloader)"

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xda
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xda

What should I do?

Thank you


texts:
I've been trying to find a way to protect my analog input pins (for my Leonardo and Pro micro). I'm basically using them to read an amplified piezo sensor output. The output is amplified because I'm using it to measure very low signal (heartbeats). The normal level of the sensor's output doesn't exceed 5V when I'm measuring heartbeats or chest movement, yet when the sensor is moved rapidly or lifted, I can expect a 5v+ voltage. I know that Arduino has an internal protection circuit, will that be enough to combat those sudden movements?
If not, I've read so many posts on this topic including this one:
http://www.thebox.myzen.co.uk/Tutorial/Protection.html

If I wanted to add a series resistor by itself as a protection will it be okay? and also, my signal is already small, wouldn't adding a resistor attenuate it even more?

Most circuits seem to have a capacitor, my signal is DC shifted upward (to avoid -ve voltage), wouldn't the capacitor remove that offset?

Finally, if I wanted to use the diode clamping diodes, which diodes should I use (i.e 1n4148 or 1n4002)?

Thank you


texts:
I am doing an aquarium light sunrise/sunset. Till now programming wise I only did the sunrise. After running the code the light starts to rise up fine, than  at full brightness, it turns off. I want to keep it on after it reaches the 100% pwm and than starts decreasing when it's time to get off. Any help on how to leave the pwm at 100% and than starts to dim when it's time to turn off? I am still new to coding arduino, so explanation need to be for a beginner :P Thanks before hand.

#include <DS3231.h>

//Set Variables
int fadeTime = 15; //Fade Time
int onHour = 12; //Light On Hour
int onMin = 00; //Light On Minute
int offHour = 19; //Light On Hour
int offMin = 00; //Light On Minute
int led = 9; //Set pinout with with PWM

DS3231  rtc(SDA, SCL);
Time t;
void start();

void setup()
{
  pinMode(led, OUTPUT);
  rtc.begin();
}

void loop()
{
  t = rtc.getTime();

  // Send Day-of-Week
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");

  // Send date
  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  // Send time
  Serial.println(rtc.getTimeStr());

  if (t.hour == onHour && t.min == onMin) //Check Time
  {
    start();
  }

}

void start()
{
  // Fade script
  for (int i = 0 ; i <= 255; i++)
  {
    analogWrite(led, i);
    delay(((fadeTime * 60000)/306));
  }

}


texts: Issues on Arduino, LiPO battery and two mottors setup

texts:
My main objective with this project was to control these two DC motors with an Arduino Nano (it is not a UNO), powered by a 3-Cell 750mAh LiPO battery (both the motors as the Arduino itself). So, I came up with something like this (it is a simplified version):

If the load on the two mottors rise, could the Arduino be damaged by this current increase? Is the voltage too high for the Arduino handle? Is there any more issues that this setup can have?

When searching, I found that it would be wise to get a fuse between the power supply and the arduino (before reaching Vin). Is that necessary?


texts: How to dynamically switch between between 2 objects?

texts:
I have a 40x4 LCD which internally consists of 2 40x2 LCDs.
To control this LCD I have to create 2 LiquidCrystal objects and than later on in code decide which one to use depending on which of the 4 lines I want to change.

Due to the size of my project, I split all the LCD handling off to a separate class.
To make my code as readable and easy as possible, I want to create a member method of this class, to which I can just pass line number 1-4, and have this method take care of deciding which LiquidCrystal object to use.

LCDController.h:

#include <LiquidCrystal.h>
class LCDControllerClass
{
 protected:

 public:
        void init(LiquidCrystal* Clcd1, LiquidCrystal* Clcd2);
 private:
   void _UpdateLCD(int _iLine, int _iPosition, String _strText, int _iFieldLength);
   LiquidCrystal* _Clcd1;
   LiquidCrystal* _Clcd2;
};
extern LCDControllerClass LCDController;

My 2 LiquidCrystal objects are initialized in my main .ino file like so (before the setup() loop)
:

LiquidCrystal lcd(12, 11, 7, 6, 5, 4);  //declare two LCD's
LiquidCrystal lcd2(12, 10, 7, 6, 5, 4); // Ths is the second

These two objects are then passed as pointers to my LCDControllerClass like so:

LCDController.init(&lcd, &lcd2);

The init() member method of my LCDControllerClass then puts these pointers in private variables like so:

void LCDControllerClass::init(LiquidCrystal* Clcd1, LiquidCrystal* Clcd2)
{
   _Clcd1 = Clcd1;
   _Clcd1->begin(40, 2);
   _Clcd1->clear();

   _Clcd2 = Clcd2;
   _Clcd2->begin(40, 2);
   _Clcd2->clear();
}

Then I have another private member method which should take care of updating the correct LCD object:

void LCDControllerClass::_UpdateLCD(int _iLine, int _iPosition, String _strText, int _iFieldLength)
{
   LiquidCrystal* CActiveLCD;
   if (_iLine > 2)
   {
      //DisplayLine is higher than 2, this means we need to update the 2nd LCD
      LiquidCrystal** CActiveLCD = &_Clcd2;
      _iLine = _iLine - 2; //Convert line number to correct line number for 2nd display
   }
   else
   {
      //LiquidCrystal** CActiveLCD = &_Clcd1;
   }
   /* we have to convert this number
      to a real display line (0-1) by substracting 1 again
   */
   _iLine = _iLine - 1;

   CActiveLCD->setCursor(_iPosition, _iLine);
   CActiveLCD->print(_strText);
}

Now in this last member mehthor my code goes into the woods for some reason. The LCD is not updated at all and it seems the arduino is freezing as well since I put a small Serial.print() test in the main loop and it's not printing anything...

What is the correct way to pass the correct LiquidCrystal object to the CActiveLCD
object?


texts: Insufficient current through Adafruit Motor Shield

texts:
I am currently using the Adafruit Motor Shield in conjunction with an Arduino Motor Shield to control two 7.2V DC Motors. The DC Motors are being powered by a 7.2V, 3000 mAh Nimh battery. When the two DC Motors are being powered in parallel directly by the Nimh battery, they are able to move rapidly and drive their load (a fairly heavy colson wheel). However, when used with the Adafruit Motor Shield intermediary, they are unable to draw enough current and hardly move at all. Is there any way I can make provide the motors with more current or force them to draw more current through the Motor Shield?

I am currently only using the arduino board to stop the vehicle at a specific point and just need a way to stop the motors after a desired point. If I cannot increase the current drawn by the motors, is there any other way I could stop the motors with the two motors directly connected to the power supply.

Here are some links to all the parts in question:

Motors

Battery


texts:
HELLO I have already connected with I2C 2 Arduino's all is working with comunication on Bus I2C. My Setup is :
MASTER with LCD I2C , RTC1037
SLAVE some sensor not I2C

I allready put 2 pullup resistor 10Kohm on SDA and SCL

I need to switch off the slave arduino but when i switch off the Slave board the Master Arduino stop working.Why? It's possible to continue working with master board and the slave board switch off? Thank's for help


texts: So, my ESP8266 now has this problem where every three seconds it goes offline for a split second and the light blinks as it comes back. It seems to be constantly resetting... I recieved this problem when I had it connected to a power brick in my pocket, and I am pretty sure it happened because of static. I would have bought a protective case for it but it appears that I csn only find 3D printed parts but I currently do not own a 3D printer. I am wondering how I can fix it. If I try to re-flash it the re-flash fails because it disconnects before the flashing finishes.


texts: Question on how "f" value is calculated in converting Morse Code to laser audio from this tutorial

texts:
I am working on this tutorial,

https://www.hackster.io/SURYATEJA/morse-code-communication-using-laser-module-both-ea1b01

and the author created a "Send" and "Receive" code for encoding and decoding Morse code. He created the "Send" code with the entire alphabet A-Z, but his receive code only has 9 letters.

I thought I could easily add in the missing characters, and even add in numbers, but I am stuck.

His code has 2 values to decode the morse - "a" and "f"

In his receive code he has a value "f" that is supposed to be calculated by the number of spaces, but I cannot see how he comes up with his result.

For example, this is his sending code for "a"

    case 'a':
MorseDot();
LightsOff(elemPause);
MorseDash();
LightsOff(elemPause);
break;

Then this is the receive code;

if(a==4 && f==10) {   Serial.print("a");

I understand the value of 4 for "a", but I cannot understand the value of 10 for "f"

"a" is calculated by assigning a value of 1 for a dot and 3 for a dash and adding the values (in this case one dot and one dash, 1+3 = 4)

He explains how to calculate "f" here in his tutorial, but I still don't understand.

When the LASER falls on the LDR, the value goes beyond 1000, and then it will enter into a loop.
Now quantize the values i.e. if the value goes beyond 1000, then assign it as '1', otherwise assign it as '0'.
Inside a loop, calculate the number of '1's and '0's. Set the counters 'a' and 'f'. Count the number of '1's and store it in 'a' and similarly count the number of '0's and store it in 'f' respectively.
Now check the specific values of 'a' and 'f' respectively. Each character will have different set of 'a' and 'f'. The matching value will be displayed.

That seems to indicate;
Laser on = Over 1000 = 1
Laser off = Under 1000 = 0

So for the letter a, I only see 2 times the laser goes off, not 10.Minof formatting changes


texts:
I'm adding WiFi (ESP8266) to my GT2560 board. Does anyone know where on the board are the RX and TX pins and the best place to connect to them?

This is all, no more info on the board in the internet and forums: https://www.geeetech.com/Documents/Users%20Manual%20of%20GT2560.pdf


texts: How to programme a button per colour for a neopixel strip?

texts:
I am trying to make a particular pixel in a neopixel strip, turn green, red or blue depending which button has been pressed and to stay on until pressed off again (like a toggle), but currently when I press one of the buttons it flashes the correct colour when button is pressed down but isn't acting as a toggle switch and then goes to a white light.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinke
#endif

#define BUTTON_PIN1  2
#define BUTTON_PIN2  10
#define BUTTON_PIN3  11
#define PIXEL_PIN    6  // Digital pin 6 connected to the NeoPixels.

#define PIXEL_COUNT 13  // Number of NeoPixels

// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

boolean oldState1 = HIGH;
boolean newState1 = HIGH;

boolean toggle1 = LOW;

boolean oldState2 = HIGH;
boolean newState2 = HIGH;

boolean toggle2 = LOW;

boolean oldState3 = HIGH;
boolean newState3 = HIGH;

boolean toggle3 = LOW;

void setup() {
Serial.begin(9600);
pinMode(BUTTON_PIN1, INPUT_PULLUP);
pinMode(BUTTON_PIN2, INPUT_PULLUP);
pinMode(BUTTON_PIN3, INPUT_PULLUP);
strip.begin(); // Initialize NeoPixel strip object (REQUIRED)
strip.show();  // Initialize all pixels to 'off'
}

void loop() {
updateButtonState1();
updateButtonState2();
updateButtonState3();

}

void updateButtonState1() {

 // Get current button state.
 newState1 = digitalRead(BUTTON_PIN1);

 if ((newState1 == LOW) && (oldState1 == HIGH)) {
 delay(50);
 newState1 = digitalRead(BUTTON_PIN1);
 if (newState1 == LOW) {
   toggle1 = !toggle1;
  }
 }
 oldState1 = newState1;

if (toggle1 == HIGH) {
strip.setPixelColor(2, 245, 15, 15); //electrical/fire hazard (red)
} else {
strip.setPixelColor(2, 0, 0, 0);
}
strip.show(); // Update strip with new contents
}

void updateButtonState2() {

// Get current button state.
 newState2 = digitalRead(BUTTON_PIN2);

if ((newState2 == LOW) && (oldState2 == HIGH)) {
 delay(50);
 newState2 = digitalRead(BUTTON_PIN2);
 if (newState2 == LOW) {
   toggle2 = !toggle2;
   }
  }
 oldState2 = newState2;

  if (toggle2 == HIGH) {
  strip.setPixelColor(2, 13, 50, 190); //Leak (blue)
  } else {
  strip.setPixelColor(2, 0, 0, 0);
  }
 strip.show(); // Update strip with new contents
 }

 void updateButtonState3() {

 // Get current button state.
 newState3 = digitalRead(BUTTON_PIN3);
 if ((newState3 == LOW) && (oldState3 == HIGH)) {
  delay(50);
  newState3 = digitalRead(BUTTON_PIN3);
  if (newState3 == LOW) {
    toggle3 = !toggle3;
  }
 }
 oldState3 = newState3;

 if (toggle3 == HIGH) {
 strip.setPixelColor(2, 58, 233, 65); //bins/recylcing (green)
 } else {
   strip.setPixelColor(2, 0, 0, 0);
  }
  strip.show(); // Update strip with new contents
}


texts: STM32 Nucleo F401RE in Arduino IDE - how to enable more than 1 Serial?

texts:
I just received a Nucleo F401RE and can't get my sketch to work on it because the compiler says Serial1 is not defined.
My sketch uses multiple serials because I need to use the usb serial monitor while also communicating to another device on a different serial port.

Here is a screenshot of the flags I selected.

According to the F401 specs it has at least 6 different serials, so the real question is: is there an easy way to use Serial1 and so on straight out of the box in the Arduino IDE?

I'm quite new and unexperienced to this field, so please excuse me if this question is too trivial.


texts: Reading bytes from a file on SD Card - Understanding Buffer

texts:
I have the following piece of code which opens a Bitmap from the SD card and outputs the width to the serial monitor.

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

File bitmap;

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

  Serial.println("Initializing SD card...");
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");

  bitmap = SD.open("/TEST2.BMP");

  int width[0]; // why can't I just write "int width;"
  bitmap.seek(18);
  bitmap.read(width, 4);
  Serial.println(width[0]); // and "Serial.println(width);"
}

void loop() {

}

It works perfectly fine but I don't understand why I have to declare the buffer for the width as int width[0];. I tried int width; but then the output is just 0.


texts: Pro Micro - Measuring voltage between two pins, without using GND

texts:
Quite new to this but making pretty good ground. I have an issue I'm not sure how to solve. I want to add a Pro Micro to an RC Toy, I can easily power it from the toys GND and 5V power. But then I want to use the voltage going to an LED on the toy (uses a different ground) to trigger an event within the Pro Micro.

I can power the Pro Micro from USB and and accomplish what I need with AnalogRead(). But if I connect the GND from the toys main power input to the GND from the LED it no longer acts as it should. I'm thinking these GNDs are not common, or are a separate circuit.

What I'm wanting to know is.. I'm using PIN10 on the ProMicro for the AnalogRead(), can I make it so that maybe PIN11 is the GND for that reading?

Thanks.


texts: SI5351 Breakout 153,600Hz Square Wave Signal

texts:
I'm trying to generate a consistent 153,600Hz square wave signal with 50% duty cycle from a Adafruit SI5351 3.3-5v breakout board for use as a fixed synchronous serial clock reference, but the closest frequency I get from it is 142,857Hz which is too far off the target.

Originally, I followed this article (my device looks exactly like the one in the pictures) from Adafruit to no avail. I tried using the Adafruit library and the mentioned ClockBuilder software, but the article makes no mention of how to apply the values returned from the software into code, and messing with the values myself didn't help either.

So, I then moved on to using this library from etherkit. It's has a lot simpler interface, and was easy for me to get at least something being output.

Here is my current code using the etherkit library running on my Arduino Mega. It seems to only output 142,857Hz, even though I specified my target frequency of 153,600Hz.

//Arduino Mega
#include "si5351.h"
#include "Wire.h"

Si5351 si5351;

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

    if (!si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0))
    {
      Serial.print("Cannot communicate with SI5351.");
    }
    else
    {
      si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_8MA);
      si5351.output_enable(SI5351_CLK0, 1);
      si5351.set_freq(153600ULL * 100ULL, SI5351_CLK0);
    }
}

void loop(){}

But here is where it gets odd: I can set the frequency argument of set_freq to anything under 120000ULL * 100ULL and the output will be spot on, but anything above that amount will "snap" back to 142,857Hz, up to 190000ULL * 100ULL.

The other thing I got working against me is that I don't have access to a oscilloscope to more accurately measure it's output. My current solution is a Arduino UNO acting as a frequency measuring tool, running the following code:

//Arduino Uno
#define pin_MeasureThis A0

volatile unsigned long on_time;
volatile unsigned long off_time;

float lfreq;
float freq;
char freq_str[12];
char msg[32];

void setup()
{
  pinMode(pin_MeasureThis, INPUT);
  Serial.begin(9600);
}

void loop()
{
  on_time = pulseIn(pin_MeasureThis, HIGH);
  off_time = pulseIn(pin_MeasureThis, LOW);
  freq = 1000000 / (on_time + off_time);

  if (freq >= 0 && freq < 999999)
  {
      dtostrf(freq, 8, 0, freq_str);
  }

  if (freq != lfreq)
  {
    lfreq = freq;

    sprintf(msg, "%sHz", freq_str);
    Serial.println(msg);
  }
}

I tested my measuring code by comparing it's measurement against visible frequencies with a LED and it performed perfectly. I do understand that probably doesn't scale well for higher frequencies, but I really have no better way right now.

Here is a sample of the exact serial output I get back from my Arduino UNO measuring the CLK0 output of the SI5351 breakout board:

  ...
  142857Hz
  125000Hz
  142857Hz
  125000Hz
  ...

Any advice on how to get to a steady 153,600Hz signal would be much appreciated. Thanks.


texts: Can't find exact Part type of Stepper Motor Driver

texts: I have searched everywhere and can't seem to find the exact model/part number for this Stepper Motor Driver.


texts: 'Class SdFat' error message with Adafruit wave shield

texts:
I'm using Arduino Uno and Adafruit Wave Shield, with the WaveRP library.
I was able to run the example programs of the waveRP library, but I try to connect a mic to the shield, didn't go well, so I returned to one of the examples to verify if the shield was working well and now is showing me this error message. I damaged the shield?

> Arduino:1.8.2 (Mac OS X), Tarjeta:"Arduino/Genuino Uno"
>
> Documents/Arduino/libraries/Adafruit_waverp/examples/dapRP/dapRP.pde:
> In function 'void setup()': dapRP:31: error: 'class SdFat' has no
> member named 'init'    if (!sd.init(SPI_FULL_SPEED))
> sd.initErrorHalt();
>
>            ^ Documents/Arduino/libraries/Adafruit_waverp/examples/dapRP/dapRP.pde:
> In function 'void play(SdBaseFile*)': dapRP:67: error: no matching
> function for call to 'SdBaseFile::readDir(dir_t&)'    while
> (dir->readDir(dirBuf) > 0) {    // Read every file in the directory
> one at a time
>
>                              ^ Documents/Arduino/libraries/Adafruit_waverp/examples/dapRP/dapRP.pde:67:29:
> note: candidate is: In file included from
> Documents/Arduino/libraries/SdFat/SdFile.h:24:0,
>                  from  Documents/Arduino/libraries/SdFat/SdFat.h:38,
>                  from Documents/Arduino/libraries/Adafruit_waverp/WaveRP.h:22,
>                  from Documents/Arduino/libraries/Adafruit_waverp/examples/dapRP/dapRP.pde:4:
> Documents/Arduino/libraries/SdFat/SdBaseFile.h:325:10: note: int8_t
> SdBaseFile::readDir(dir_t*)    int8_t readDir(dir_t* dir);
>
>           ^ Documents/Arduino/libraries/SdFat/SdBaseFile.h:325:10: note:   no known conversion for argument 1 from 'dir_t {aka
> directoryEntry}' to 'dir_t* {aka directoryEntry*}' exit status 1
> 'class SdFat' has no member named 'init'
>


texts:
I use a Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates to collect data on animal movement.

I have two questions regarding the produced NMEA:
- there are some information about PGACK, PMTK that are produced in the code that I don't need. Do you know a way of not including it?
- I'd like to add some information in the NMEA line, but when I do it, it creates a space between the NMEA and the new information that do not allow me to process it correctly then in Excel or R. This is the information I've added:

fichier.print(buffer);
fichier.print(",");
fichier.print(GPS.hour, DEC);
fichier.print(':');
fichier.print(GPS.minute, DEC);
fichier.print(':');
fichier.print(GPS.seconds, DEC);
fichier.print(",");
fichier.print(GPS.day, DEC); fichier.print('/');
fichier.print(GPS.month, DEC); fichier.print("/20");
fichier.print(GPS.year, DEC);
fichier.print(",");
fichier.println(j);
fichier.close();
acquisition = true;


texts:
Some sensors give as output a voltage between 0 and 5V. The analog inputs of the NodeMCU require voltages between 0 and 3.3V. I plan to make a voltage divider with two resistors like in this link for compatibility.

To provide the desired voltage the quotient of the values of the resistances is fixed (approx. 1/2 for this case). However, the absolute values of the resistances are not.

Q: How to choose those absolute values? Which are the criteria and why?

I have a good background in electromagnetism but I know very few about electronic Engineering.

I think that low values must work, e.g. 1Ω and 2Ω (and surely greater values). But I am unsure of VERY high resistance values because I suspect that there should be some current intensity requirements.

Thank you.


texts: Reducing read time for reading DS18B20 temp sensors

texts:
I have a number of temperature sensors connected up to an Arduino - I've split it into 3 sections, with each section having a 2-4 sensors on it (due to distances).   This works, but the code I'm using would seem to me to be very inefficient - particularly with respect of how long it takes to read all the sensors.

I've got 3 code blocks one after each other (which are modified from some code online) which look as below - save, of-course, for the name of the 1wire class.

// Dallas 1 Wire (Main Area):

 //  ds.reset_search();
 //  delay(250);
  while (ds.search(addr))
  {
    for( i = 0; i < 8; i++) {
      Serial.print(addr[i], HEX);
    }

    if (OneWire::crc8(addr, 7) != addr[7]) {
        Serial.println("CRC is not valid!");
        return;
    }

    ds.reset();
    ds.select(addr);
    ds.write(0x44, 0);        // start conversion, with parasite power on at the end

    delay(1000);     // maybe 750ms is enough, maybe not
    // we might do a ds.depower() here, but the reset will take care of it.

    present = ds.reset();
    ds.select(addr);
    ds.write(0xBE);         // Read Scratchpad

    for ( i = 0; i < 9; i++) {           // we need 9 bytes
      data[i] = ds.read();
    }
    raw = (data[1] << 8) | data[0];
    if (type_s) {
      raw = raw << 3; // 9 bit resolution default
      if (data[7] == 0x10) {
        // "count remain" gives full 12 bit resolution
        raw = (raw & 0xFFF0) + 12 - data[6];
      }
    } else {
      byte cfg = (data[4] & 0x60);
      // at lower res, the low bits are undefined, so let's zero them
      if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
      else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
      else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
      //// default is 12 bit resolution, 750 ms conversion time
    }
    celsius = (float)raw / 16.0;
    Serial.print(":");
    Serial.print(celsius);
    Serial.print(",");
  }

I note that there is a 1000ms delay after each sensor is read, and I'm wondering if I can reduce this to a single 750ms delay for all the sensors.  My initial attempts to do this did not meet with success - but I confess that I can't quite get my head around the ds.reset, ds.select etc - and my initial attempts to do this have all failed.

Is it possible to remove this delay after reading each sensor ?


texts: NeoPixel setPixelColor works only in for loop

texts:
I am working with a NeoPixel RGB led and have gone through various tutorials but I have a question regarding the setPixelColor().

If I do not have my setPixelColor() and show() inside of a for loop it will not work.

This works:

void holoLight(uint32_t c){
  for(uint16_t i = 0; i<2; i++){
    holo_pxl.setPixelColor(i, c);
    holo_pxl.show();
    delay(2500);
  }
}

This does not:

void holoLight(uint32_t c){
    holo_pxl.setPixelColor(1, c);
    holo_pxl.show();
    delay(2500);
}

I am sure it is something specific to the language or execution but would love some clarifications, thanks =)


texts: How to improve response time of this sound operated LED?

texts:
I have written the following code for lighting an LED on a  clap ( using sound sensor)   that I have connected via a resistance of  330 OHM on pin number 4.

However, when I clap once,  close to the sound sensor,  it does not lights  the LED. But it only lights the LED if  I provide prolong exposure to sound  ( more than 6 seconds) on the sound sensor.

How can I improve this , so that even if I clap once for a seconds duration, the LED glows?

int soundSensor=10;
int LED=4;

void setup()
{
 Serial.begin(9600);
 pinMode(soundSensor,INPUT);
 pinMode(LED,OUTPUT);
}

void loop()
{
  int SensorData=digitalRead(soundSensor);
  if(SensorData==1)
  {

     digitalWrite(LED,HIGH);
  delay(3000);

     Serial.println("LOUD, LOUD");
     delay(1000);
  }
    else
  {

     digitalWrite(LED,LOW);
     Serial.println("SLOW, SLOW");
     delay(1000);
  }
 }


texts: I am using arduino uno and window7 64bit.I can't upload my program to arduino uno.When I upload it the warning message is show me.The warning message is"WARNING:Category 'USB' in library keyboard and mouse is not valid. Setting to 'Uncategorized'.What can I do?


texts:
I recently bought a GPRS shield from Seeed Studio but was having issues running the programs described in their documentation.  Here is everything you need to know about my shield:

Documentation for GPRS Shield V2.0

Website to purchase GPRS Shield V2.0

I assumed that there was a connection problem. I used the following code to try to debug my SIM900 and its connections to the sim card and the cellular network:

#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(7,8);

void setup(){
  gprsSerial.begin(19200); // GPRS shield baud rate
  Serial.begin(19200);
  delay(500);
}

void loop(){
  if(Serial.available()) {
    switch(Serial.read()) {
      case '0': testSIM900(); break;
        // AT OK
      case '1': testSIMCARD(); break;
        // +CPIN: READY
        // +CREG: 0,1
      case '2': testNETWORK(); break;
        // +CGATT: 1
    }
  }

  if(gprsSerial.available()) Serial.write(gprsSerial.read());
}

void testSIM900() {
  gprsSerial.println("AT");
  // AT OK
  delay(100);

}

void testSIMCARD() {
  gprsSerial.println("AT+CPIN?");
  // +CPIN: READY
  delay(100);
  gprsSerial.println("AT+CREG?");
  // +CREG: 0,1
  delay(100);
}

void testNETWORK() {
  gprsSerial.println("AT+CGATT?");
  // +CGATT: 1
  delay(100);
}

When I entered 0, 1, and 2 into the serial monitor, I got the following response:

AT

OK
AT+CPIN?

+CPIN: READY

OK
AT+CREG?

+CREG: 1,2

OK

+CREG: 0

+CGREG: 0
AT+CGATT?

+CGATT: 0

OK

What does this tell me about the current state of my shield, sim card, and network connection? Is there anything else I can do to isolate issues?


texts: Getting the contacts/ storing contacts to SIM card

texts:
I have the GSM shield and is there any ways to get the stored contacts on the SIM card? It seems that the GSM library does not support writing data onto/ reading data from the SIM card?

My aim is to store the SIM card's phone number and some variables onto the SIM card itself, such, I would not need to change the program from time to time.

All I need to do is enter all the variables in the SIM card via any mobile phone (perhaps by storing the variables as contacts, as phone book function should be very common on phones).


texts:
I am new to Arduino and am trying to figure out servos. Right now I have a toggle button code for the servos. Although I want to know how to speed them up. Is there a way to do this?

Currently, this is my code:

#include <Servo.h>
int button = 5; //button pin, connect to ground to move servo
int press = 0;
Servo servo_7;
Servo servo_8;
Servo servo_9;
Servo servo_10;
boolean toggle = true;

void setup()
{

  pinMode(button, INPUT); //arduino monitor pin state
  servo_7.attach(7); //pin for servo control signal
  servo_8.attach(8);
  servo_9.attach(9);
  servo_10.attach(10);
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press = digitalRead(button);
  if (press == LOW)
  {
    if(toggle)
    {

      servo_7.write(180);
      servo_8.write(180);
      servo_9.write(180);
      servo_10.write(180);
      toggle = !toggle;
    }
    else
    {

      servo_7.write(0);
      servo_8.write(0);
      servo_9.write(0);
      servo_10.write(0);

      toggle = !toggle;
    }
  }
  delay(100);  //delay for debounce
}


texts:
Hi im a student having problem in coding
I  want to set two reed switch in two direction.
Example : 1. Reed switch 1 detect then reed switch 2 detect - led turns to yellow
2.If reed switch 2 detect first then reed switch 1 detect - led turns to red
 It should play in sequentially form. Can help me in coding?
So far i have done this..

const int REED_PIN1 = 2; // Pin connected to reed switch const int REED_PIN2 = 3; // Pin connected to reed switch

const int RED = 9; // LED pin - active-high const int GREEN = 10; // LED pin - active-high const int YELLOW = 11; // LED pin - active-high

int up = 0; int down = 0;

void setup() { Serial.begin(9600); // Since the other end of the reed switch is connected to ground, we need // to pull-up the reed switch pin internally. pinMode(REED_PIN1, INPUT_PULLUP); pinMode(REED_PIN2, INPUT_PULLUP);

pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(YELLOW, OUTPUT);

digitalWrite(RED, LOW);
digitalWrite(GREEN, HIGH);
digitalWrite(YELLOW, LOW);
}

void loop() { int proximity1 = digitalRead(REED_PIN1); // Read the state of the switch int proximity2 = digitalRead(REED_PIN2); // Read the state of the switch while (proximity1 == LOW) // If the pin reads low, the switch is closed. {

up  = up  + 1;
Serial.print(up);
Serial.print("        ");
Serial.println(down);

if(down < 1){
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);

delay(1000);
}

else {
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);

delay(1000);
}
} while (proximity2 == LOW) // If the pin reads low, the switch is closed. { up = up - 1; Serial.print(up); Serial.print(" "); Serial.println(down); if(up < 1 && down < 1){ digitalWrite(RED, LOW); digitalWrite(GREEN, LOW); digitalWrite(YELLOW, HIGH);

delay(3000);      }
else{
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);

delay(1000);
}
} while (proximity2 == LOW) // If the pin reads low, the switch is closed. { down = down + 1; Serial.print(up); Serial.print(" "); Serial.println(down);

if(up > 1){
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, HIGH);

delay(1000);
}

else {
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);

delay(1000);
}
delay(1000);
}
while (proximity1 == LOW) ;// If the pin reads low, the switch is closed. { down = down - 1; Serial.print(up); Serial.print(" "); Serial.println(down); if(up < 1 && down > 1){ digitalWrite(RED, HIGH); digitalWrite(GREEN, LOW); digitalWrite(YELLOW, LOW);

delay(5000);      }
else{
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);
delay(5000);} } }


texts: Problem controlling a Stepper motor with AccelStepper in arduino uno

texts:
I have an Arduino connected to a stepper motor with an Easy Driver. I want for the stepper motor turn to a coordinate point. I wrote a simple program in Visual Studio that sends a coordinate point to the Arduino. I tried to write this below to plot the coordinate point, but when I send a number to the Arduino, the stepper motor will only turn one step. I don't know how fix this.

Can anyone fix this problem please?

#include <AccelStepper.h>

AccelStepper stepper(1, 9, 8);

void setup()
{
  Serial.begin(9600);
  stepper.setMaxSpeed(10000);
  stepper.setAcceleration(5000);
}

void loop()
{
  char c;

  if(Serial.available())
  {
    int steps = Serial.read();
    stepper.moveTo(steps);
  }
  stepper.run();
}


texts:
I want to display the RFID tag value to a html file.

I am using ESP8266 ESP-01 module, EM-18 Reader Module, Arduino Uno and Xampp for hosting PHP.

Right now, I am getting a value of "255" in Arduino whenever I scan a RFID tag. But I am supposed to get the 12-digit alphanumeric RFID tag value.

I have attached the Arduino and also the output screen of the Serial Monitor.

I have my college submission next week so it's urgent. Any help would be appreciated.

#include "SoftwareSerial.h"
String ssid ="Home";
String password="****";
SoftwareSerial esp(2, 3);// RX, TX
String data;
String server = "192.168.0.182"; // www.example.com
String uri = "/testget.php";// our example is /esppost.php
int DHpin = 0;//sensor pin
byte dat [12];
String tag;

void setup() {
  pinMode (DHpin, OUTPUT);
  esp.begin(9600);
  Serial.begin(9600);
  reset();
  connectWifi();
}

//reset the esp8266 module

void reset() {
  esp.println("AT+RST");
  delay(1000);
  if(esp.find("OK") )
    Serial.println("Module Reset");
}

//connect to your wifi network

void connectWifi() {
  String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";
  esp.println(cmd);
  delay(4000);
  /*
  if(esp.find("OK")) {
    Serial.println("Connected!");
  }
  else {
    connectWifi();
    Serial.println("Cannot connect to wifi"); }*/
}

byte read_data () {
  byte data;
  for (int i = 0; i < 13; i ++) {
    if (digitalRead (DHpin) == LOW) {
      while (digitalRead (DHpin) == LOW); // wait for 50us
        delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1'
      if (digitalRead (DHpin) == HIGH)
        data |= (1 << (12-i)); // high front and low in the post
      while (digitalRead (DHpin) == HIGH);
// data '1 ', wait for the next one receiver
    }
  }
  return data;
}

void start_test () {
  digitalWrite (DHpin, LOW); // bus down, send start signal
  delay (30); // delay greater than 18ms, so DHT11 start signal can be detected
  digitalWrite (DHpin, HIGH);
  delayMicroseconds (40); // Wait for DHT11 response
  pinMode (DHpin, INPUT);
  while (digitalRead (DHpin) == HIGH);
    delayMicroseconds (80);
  // DHT11 response, pulled the bus 80us
  if (digitalRead (DHpin) == LOW);
    delayMicroseconds (80);
  // DHT11 80us after the bus pulled to start sending data
  for (int i = 0; i < 13; i ++)
    // receive tag value data, the parity bit is not considered
    dat[i] = read_data ();
  pinMode (DHpin, OUTPUT);
  digitalWrite (DHpin, HIGH);
  // send data once after releasing the bus, wait for the host to open the next Start signal
}

void loop () {
  start_test ();
  // convert the bit data to string form
  tag= String(dat[12]);
  data = "tag=" + tag;// data sent must be under this form //name1=value1&name2=value2.
  Serial.println(data);
  httppost();
  delay(1000);
}

void httppost () {
  esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.
  if( esp.find("OK")) {
    Serial.println("TCP connection ready");
  }
  delay(1000);
  String postRequest =
  "POST " + uri + " HTTP/1.0\r\n" +
  "Host: " + server + "\r\n" +
  "Accept: *" + "/" + "*\r\n" +
  "Content-Length: " + data.length() + "\r\n" +
  "Content-Type: application/x-www-form-urlencoded\r\n" +
  "\r\n" + data;
  String sendCmd = "AT+CIPSEND=";//determine the number of caracters to be sent.
  esp.print(sendCmd);
  esp.println(postRequest.length() );
  delay(500);
  if(esp.find(">")) {
    Serial.println("Sending..");
    esp.print(postRequest);
    if( esp.find("SEND OK")) {
      Serial.println("Packet sent");
      while (esp.available()) {
        String tmpResp = esp.readString();
        Serial.println(tmpResp);
      }
      // close the connection
    esp.println("AT+CIPCLOSE");
    }
  }
}

Output :


texts: Confusion receiving I2C data from magnetic sensor

texts:
So, I've found the address of my device using a I2C device scanner. I then looked up the datasheet for a magnetic sensor I am trying to grab data from.

I'm now trying to communicate with the device by following the 'Example Measurement' section in the data sheet.

Here is my code so far...

#include <Wire.h>
#define address 0b110000 // find the actual address, it is at 0x30, which is 0b00110000

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

void loop() {
  int x, y, z;

  Wire.requestFrom(0b00110000, 1); // START condition?, starts with a 0 to indicate a WRITE request
  if(Wire.available() > 0) {
    Serial.println("1");
    Wire.read();
  }
  Serial.println(Wire.read());
  Wire.write(0b00000111);
  if(Wire.available() > 0) {
    Serial.println("2");
    Wire.read();
  }
  Wire.write(0b00000001);
  if(Wire.available() > 0) {
    Serial.println("3");
    Wire.read();
  }
  Wire.requestFrom(0b00110000, 1); // write request
  if(Wire.available() > 0) {
    Serial.println("4");
    Wire.read();
  }
  Wire.write(0b00000110);
  if(Wire.available() > 0) {
    Serial.println("5");
    Wire.read();
  }
  Wire.requestFrom(0b10110000, 1); // READ request
  if(Wire.available() > 0) {
    Serial.println("6");
    Wire.read();
  }
  // not sure what to do for the 7th cycle???
  // am I even doing the previous correct?
  Wire.endTransmission(address);
  delay(1000);
}

The numbers in each of the if statements represent the cycle within the 'Example Measurement' section of the datasheet, I'm never able to read data from the device and I am sure that I am doing something wrong.

I appreciate any help! This is my first time ever trying to understand I2C, and I've just been staring at this datasheet for too long without getting anywhere.


texts:
I'm using MPU 6050 and there's a thermometer onboard. However, I looked through the chip set data sheets but could not find the instruction for temperature sensing.

Could you tell me how to calibrate the data string from the two address started from 0x41?


texts:
How can i concatenate integers as a single string?

int out1, out2, out3 = 0;

    out1 = digitalRead(r1);
    out2 = digitalRead(r2);
    out3 = digitalRead(r3);

I tried like so, between others, with no luck.

Serial.write(out1 + "" + out2 + "" + out3);

For example the expected result when all outputs are HIGH should be 111, while when only the r3 output is HIGH it should be 001

All i want, is reporting to the sender of the serial command, the pins state


texts: Attempt stacking 'CAN-BUS' and 'USB Host' Shields on Mega 2560

texts:
I've run into a case of 'In theory it works, but in reality'....

I'm using the CAN-BUS Shield V1.2 from Seeed studio. Many things are written in broken english, so I'm starting to wonder if I can trust all of the information. http://wiki.seeed.cc/CAN-BUS_Shield_V1.2/

The USB Host Shield is a discontinued official Arduino model. https://www.arduino.cc/en/Main/ArduinoUSBHostShield

(I would link to the libraries, but I am unable to post more than 2 links)

CAN-BUS Pins:

AREF
ICSP (SCK, MISO, MOSI)
P9 - CS (SS)
P2 - INT
NC
IOREF
RST
3.3V
5V
Vin

USB Host Pins:

ICSP (SCK, MISO, MOSI)
P10 - SS
P7 - GPX
P8 - INT (actually RES?)
P9 - RES (actually INT?)

The only conflict I see is Pin 9 (CS on CAN, RES on USB). This is where it gets hazy... While the documentation on the bottom of the USBHost page implies that Pin 9 is RES, in the code Pin 9 is actually INT.

So, assuming Pin 9 is actually INT, I re-routed it to Pin 45 on on the Mega and changed it in the UsbCore.h file:

//typedef MAX3421e<P10, P9> MAX3421E; // old
typedef MAX3421e<P10, P45> MAX3421E; // new

Here is a snippet of the code I am running:

#include <PS3BT.h>
#include <usbhub.h>

#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>
#endif

#include <Bounce2.h>
#include <Time.h>
#include <TimeLib.h>
#include <SPI.h>
#include "mcp_can.h"

const int SPI_CS_PIN = 9;

MCP_CAN CAN(SPI_CS_PIN); // Set CS pin

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

    // THIS WORKS
    if (Usb.Init() == -1) {
        Serial.print(F("\r\nOSC did not start"));
    }
    Serial.print(F("\r\nPS3 Bluetooth Library Started"));

    // THIS FAILS
    while (CAN_OK != CAN.begin(CAN_500KBPS))
    {
        Serial.println("CAN BUS Shield init fail");
        Serial.println(" Init CAN BUS Shield again");
        delay(100);
    }
    Serial.println("CAN BUS Shield init ok!");
}

The CAN-BUS Fails to init until I physically remove the USB Host Shield.

If I remove the CAN-BUS code, The USB Host Shield functions normally.

If I remove the USB Host code, the CAN-BUS Shield still DOES NOT init.

I tried to sift through the CAN-BUS init code a little, and I can only assume it's failing to communicate via SPI. What am I missing here?


texts: Is it possible for ThingSpeak to show a simple table of all data collected?

texts: I just recently found the ThingSpeak platform for the IoT. I have been playing around with its features a bit, but I have not found a way for it to show a simple table of all the data collected. For example, the table might have humidity, temperature, and timestamp columns, and then every time data is written to ThingSpeak, a new row would be added with the latest readings. I would be surprised if this is not possible with all of its complex graphing tools. Has anybody found a feature like this?


texts: ESP8266 Nodemcu create custom PWM with 1.25us resolution

texts:
I am trying to control some SMD LEDs WS2812B with the ESP8266-Nodemcu. I am using Arduino environment for coding. Actually I am trying to accomplish a PWM  that is precisely able to:

Go High for 850ns and then
Go Low for 400ns

According to the Spec this, this High Low change is considered as a bit with value 1.

I have tried to delay between the lows and highs, without an effort (delays only work for microseconds and above i suggest).

Do you have any idea how to accomplish that?


texts: Is there any problem about calling if (Serial) many times?

texts:
I am trying to debug a problem that I think may be related to the debug code itself and I tried to use theese macros:

#define DEBUG_PRINT(x) { if (Serial) { Serial.print(x);} }
#define DEBUG_PRINTLN(x) { if (Serial) { Serial.println(x);} }

That works a bit but everything starts running really slow and my sketch get to hung up quite fast. Maybe it is timing related but does not seems like that.

if I change that by this the problem is gone:

#define DEBUG_PRINT(x) { if (true) { Serial.print(x);} }
#define DEBUG_PRINTLN(x) { if (true) { Serial.println(x);} }

I'm using Arduino Pro Micro (Leonardo).

Is there any problem about calling if (Serial) so many times?

Full sketch here


texts:
The MKR1000 is still pretty new and I'm having a hard time getting good information on it. I'm using the Arduino IDE but don't find any functions to sleep the MKR1000. Most libraries I encounter are for AVR chips while the MKR1000 has an ARM chip. I want to put it to sleep until an external interrupt is called. I also use the millis() function, will this function be rendered useless if it goes to sleep?

In the data sheet for the ATSAMD21 it talks about the Wait for Interrupt instruction which puts the machine to sleep but it doesn't say how to call the instruction. How can I do this in the Arduino IDE?


texts: Self answering a Intercom and playing louldy for person to response

texts:
We have two labs - one in 1st floor and other at 2nd floor. We are connected by intercom - both the labs has one device each. The issue is that the person who sits near the intercom is busy through out day answering the intercom and reaching out to the person for whom the call is made for.

This is very tiresome and hence I wish to automate this. I have an Arduino Mega 2560 board. My plan is to make Arduino receive the call ask for the person whom the caller is reaching out and play the name loudly over speaker in all rooms of labs (to attended the phone). If the user does not turns up even after 3 repeated times of calling - disconnect the call. If the user answers the phone by picking up the receiver then turn the conversation speaker mode off until call has not ended.

I have Arduino Mega 2560 board which has 4 serial ports but I am not user what would be the circuit to make this functionality workable? What are the extra h/w required and concept of its implementation.


texts: How much voltage/current do I need for multiple chips?

texts: I have a Huzzah ESP826 Wifi breakout chip which requires 3.3V power voltage and peaks at 500mA of current, and an LED strip which requires 12V and 1A.  How can I power both with one dc jack (I have a 12V 5A power supply) on one breadboard?


texts: How to change the update rate in TinyGPS++?

texts:
I am working with TinyGPS++ library and Arduino-nano and I want to change the update rate.
I worked before with Adafruit GPS and uses the below code for updating it.
// Set the update rate
 GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate

I have also worked with NMEAGPS.h to update every 30sec.
gps.send_P( &gpsPort, F("PMTK220,30000") );        //update 1time in 30s

So how to change the upsate rate for TinyGPS++ library? as I want to update 1 time in 30seconds.


texts: Accelerometer (I2C) and Fona Shield (software serial) won't work together

texts:
I am using a Fona 808 shield with an Arduino Uno and the LSM303 accelerometer. The accelerometer is connected via I2C and the Fona uses software serial.

My project requires the accelerometer to be continuously polled and occasionally talk with the fona. I wrote a program that just used the fona, but once I added the accelerometer code the program would hang a few seconds after comms had been opened with the Fona. I have tested both the accelerometer and the fona shield separately, and they work fine. So, I wrote another smaller (test) program (which is attached below) to find the origin of the program, which I identified to be:

fonaSerial->begin(4800);

fona.begin(*fonaSerial);

After these lines of code are added, the problem arises. As I said before, this is what I see a few seconds after comms have been opened with the Fona.
http://pasteboard.co/A16708fo3.png

My test program reads the value from the accelerometer, calculates the magnitude of the acceleration and if it's over 20, it prints "Over 20", while also initialising Fona serial.

My question is: Why don't the accelerometer (I2C) and the Fona (Serial) work together and how this be fixed?

This is quite urgent so a quick responses are greatly appreciated!

My Code:

#include <Adafruit_FONA.h>
#include <Adafruit_Sensor.h>
#include <My2_Adafruit_LSM303_U.h>
#include <Wire.h>

#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4

#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;

Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

volatile byte accelMagnitude;

Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(54321);

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

    accel.begin();

    Serial.begin(115200);

    fonaSerial->begin(4800);
    fona.begin(*fonaSerial);

}

void ReadAccel(){

//Get a new accelerometer sensor event
  sensors_event_t event;
 // Serial.println(F("Accel---------"));
  accel.getEvent(&event);

  accelMagnitude = sqrt( sq(event.acceleration.x) + sq(event.acceleration.y) + sq(event.acceleration.z));

}

void loop() {
    // put your main code here, to run repeatedly:

    ReadAccel();

    if (accelMagnitude > 20){

        while (accelMagnitude > 20){

            Serial.println("waiting");
            ReadAccel();
        }

        Serial.println("Over 20");

    }
}


texts: How to count the number of times a changing variable reaches a peak value

texts:
I am recording a varying distance with an Ultrasonic sensor and Arduino but my problem is I want to display the number of times this variable reaches peak (at an instance the value will be increasing and the next instance decreasing in that order) on an LCD.

So far this is my code:

//Libraries
#include <Ultrasonic.h>
#include <LiquidCrystal.h>

//Setup connection with LCD and HC-SR04
LiquidCrystal lcd(12, 10, 5, 4, 3, 2);
Ultrasonic ultrasonic(A0,A1);

void setup() {
  //Lcd init
  lcd.begin(16, 2); //16 rows, 2 columns
}

void loop()
{
  lcd.clear();
  lcd.print("  Ardumotive ;)  "); // You can change this message.
  lcd.setCursor(0, 1);
  lcd.print("Distance: ");
  lcd.print(ultrasonic.Ranging(CM));
  lcd.print("cm");

  delay(300); // 1sec delay
}


texts: Connect to Arduino 2560 using a RS232 Connection

texts:
Is it possible to connect to an Arduino 2560 using a RS232 (DB9) connection rather than the regular connection using USB cable?

I am thinking of this connection scheme:

PC -> USB cable -> USB to RS232 Multiplexer -> DB9 Cable -> Adapter board -> Arduino 2560


texts: Double precision floating point operations using Arduino

texts:
Today we were programming something in university which dealt with really large numbers (even larger than unsigned long) and we had to create a code that broke the  numbers into an array and performed operations on them.

I know that an Arduino is an 8 bit MCU, but I was wondering if similar approaches could be used to do 32 bit double precision floating point operations (or even better,  i.e quad precision, etc) using the Arduino (e.g. create a quad precision calculator or similar applications).

I know it sounds silly or similar to a brute force method, but I'm really curious if it's possible to do such things.


texts: What happens if I don't use a relay for 5V pump

texts:
I am trying to build an automatic watering system by following some examples. However, I don't have all the components for the entire system, therefore I have built it in Fritzing using only the components that I have (see scheme below):

I didn't build the physical version yet, because I am not sure that such a system would work without burning anything. In many examples, people connect the pump to a Relay Module, but since I don't have it yet, I would like to build it like this until I set up the watering system.

Can anyone help me understand why a relay would make it better or worse?

P.S. I have a JPC-3F relay, but I can see that the Relay Module contains multiple components. Is it possible to add the JPC relay to the pump without having the entire Relay Module? Would I need extra components for that?

Thank you!

EDIT: Thanks to the answer from ratchet freak, I have added resistances and a transistor. It works fine, but the same question stands. Do I still need a relay in this case?


texts:
I'm writing a char array to a device with an arduino mega that should be giving me an echo back, instead, I'm getting an array back with different chars that correspond to my sent function, but not in a way I can figure out. for example {1,6,250,0,91,233,252} returns the array {127,62,1,146,90,0,0}
As 1 is always returning 127, I'm guessing it has something to to with how I'm casting my received data, but after messing with it for a few hours, I can't seem to get it to cast correctly.
Main Function
gets destination address and data, echos back if requested
calls CRC(this works fine) and SkRead(the problem area)
void Create_Message(int Address, int Data, bool echo)
{
  lcd.setCursor(0,1);
  lcd.print(Address);
  lcd.print(" ");
  lcd.print(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};
  uint16_t crc=CRC(AdDa,sizeof(AdDa)/sizeof(AdDa[0]));
  byte CrcHi = crc >> 8;
  byte CrcLo = crc & 0xFF;
  /*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]
  */
  unsigned char cmd[8]={SvAdd,FuCode,AddHi,AddLo,DatHi,DatLo,CrcLo,CrcHi};
  for (int i=0; i< 8; i++)
  {
  Serial1.write(cmd[i]);   // Send string
  if(echo){Serial.print(cmd[i]);Serial.print('.');}
  }
  if(echo){Serial.println();}
  if (SkRead(echo) == cmd)
  {
  Serial.print(Address);
  Serial.print('\t');
  Serial.println(Data);
  }
  //clear line
}

CRC
(works fine, just wanted to show full code)
/*---Create CRC Function---*/
uint16_t CRC(byte AdDa[], int Size )
{
  uint16_t crc16 = 0xFFFF;
  int pos = 0;
  int i = 0;
  /*Write CRC*/
  for (pos = 0; pos < Size; pos++)
  {
    crc16 ^= AdDa[pos];          // XOR byte into least sig. byte of crc
    for (i = 8; i!= 0; i--) // Loop over each bit
    {
      if ((crc16 & 0x0001) != 0)        // If the LSB is set
      {
        crc16 >>= 1;                      // Shift right and XOR 0xA001
        crc16 ^= 0xA001;
      }
      else
      {
        crc16 >>= 1;                      // Shift right
      }
    }
  }
  /*Note, this number has low and high bytes swapped,
  so use it accordingly (or swap bytes)*/
  return crc16;
}

SkRead
This is my problem area, I'm sure the data is being sent and read correctly, but one of my assignments is throwing it off so the received echo is not received in a way that matches what is sent.
unsigned char SkRead(bool echo)
{
  digitalWrite(Pin13LED, HIGH);  // Show activity
  outputstring = "";
  unsigned long bide=millis()+2000;
  byte inChar;
  while(Serial1.available()<8 && bide>millis()){}
  while(Serial1.available())
  {
    inChar = (byte)Serial1.read();
    outputstring += (char)inChar;
  }
  //Serial.println(outputstring);
  digitalWrite(Pin13LED, LOW);  // Show activity
  int charl = outputstring.length() + 1;
  unsigned char outputschar[charl];
  outputstring.toCharArray(outputschar,charl);
  if (echo)
  {
    for (int i=0; i< charl; i++)
    {
     Serial.print(outputschar[i]);
     Serial.print('.');
    }
    Serial.println();
  }
  return outputschar;
}


texts: What is the minimum wattage of resistors for breadboarding with Arduino Uno?

texts: I'd like to buy new resistors for breadboarding with my Arduino Uno. There are 0.25W, 0.4W, 0.6W, 1W, 2W, 3W, 5W, 10W resistors in the shop. What is the most suitable for this operation?


texts: Digispark / DigiKeyboard change keyboard layout

texts:
I'm trying to use the Digispark as a Rubber Ducky but the Digispark is only usable with the US laylout. German keyboard layout is QWERTZ. Some keys can be changed, like y and z, but if there are [ or ] this isn't possible. Trying to define a [-key in DigiKeyboard.h displays a ü.

Does someone know a solution?


texts: Arduino UNO Chinese Clone LEDs not lighting up

texts:
Hi all,

In the screenshot of a circuit I've included, I'm attempting to light up 4 LEDs off of pin 2. In circuits.io, everything works great. 3 blue LEDs and 1 red LED light up and blink as planned. When I create this same circuit on a Arduino Uno Chinese clone, IF the LEDs are all blue, they all light up and blink. If I change one of them to red, yellow, or green, ONLY the red, yellow, or green one lights up. The three blue LEDs no longer light up. It also doesn't seem to matter, where the off blue LED is put.

Not sure what's wrong.


texts:
I have a strip of 7 leds. its ws2812. Im starting them on blue. Next I want them to do a slow fade into pink. So all Im trying right now is to increment r.

I can get them to work one by one. But I need them to all fade together from blue to pink.

Ive moved my r++ loop around till I was cross-eyed. Still it didnt fade all 7 leds to pink all at once.

sometimes it would stay blue and do nothing sometimes fade to pink one pixel at a time.

How do I get all 7 leds to fade together?
Thank you.

#include <FastLED.h>
#define NUM_LEDS 7
#define DATA_PIN 6
#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100

int r; //changed it to undefined

CRGB leds[NUM_LEDS];

void setup(){
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);

 }
void loop(){

this lights all leds to blue

  for(int x = 0; x < NUM_LEDS; x++){

  leds[x] = CRGB(r,g,b);
 }
  FastLED.show();
  delay(10);

this code should grab all 7 leds in NUM_LEDS store it in x

  for(int x = 0; x < NUM_LEDS; x++){

  leds[x] = CRGB(r,g,b);

Heres the problem area. I get no errors but it doesnt fade all 7 leds at a time.
Ive tried moving my code around but it either doesnt fade or fades to pink one led at a time. where should my 'for loop' for incrementing r be at?
Should I be changing rgb all at once using array?

//take r and fade it up to 254

for(int r = 0; r < 254; r++) {

  }
  }
     FastLED.show();
 delay(100);

}


texts: light detection system: Response different from power bank and computer system

texts:
Hello friends

I'm working on a light detection system for the higher secondary summer term project, for which I'm using a simple Arduino board, Adafruit 16-Bit ADC, an LDR with some resisters, a 5V USB power source either the computer USB 2.0 port or a mobile power bank 5V-500mA/1A/2.1A, a USB mobile charging cable (not the data cable) and a Bluetooth module to communicate with Arduino system, an android or a computer (different from Arduino power source) to record the data.

The difference in maximum and minimum response is very poor when replacing the power source from the computer USB to power bank USB. With the same environmental and experimental conditions, the response goes from 50000 to 45000 counts (the changes in response are 5000 counts) with the power bank. For the same situations, the response goes from 50000 to 5000 counts (the changes are 45000) with the computer power source which is more suitable but it's better to use a small power supply.

How can I get the better and stable response? Kindly help me to solve out this issue. Thank you.


texts: U-Blox Neo M8N GNSS-GPS interface with ESP32-TTGO-T-CALL

texts:
I have tried contacting the manufacturers as well as many Google searches.
I have tried many different libraries to get this GNSS-GPS working.
Libraries I've Tried:

Arduino_GPS

Arduino_Parser_Ublox_Neo_M8N

esp32-ublox

MicroNMEA

NEO-M8N

NeoGPS

UBLOX-NEO-M8N

The library I am trying now:

Parser_Ublox_Neo_M8N
with:
ESPSoftwareSerial

(I have a non-AVR board so NeoSWSerial and SoftwareSerial didn't work for me.)
Link to files on GitHub:
https://github.com/toskyRocker/Arduino_Parser_Ublox_Neo_M8N
My questions for someone who has done this before with a U-Blox M8N:

Must I use U-Center software to configure the gps before it will output data?
Does my code look to be functional? I can compile but then when attaching GPS I get the output (as my psuedo error message) that lets me know the serial connection between my TTGO T-Call V1.3 and U-Blox-M8N is not valid.
Here is a link to the board I have and the GNSS-GPS:

Board:
https://www.ebay.com/i/284030711638?chn=ps&norover=1&mkevt=1&mkrid=711-213727-13078-0&mkcid=2&itemid=284030711638&targetid=4580840328168117&device=c&mktype=&googleloc=&poi=&campaignid=403206339&mkgroupid=1235851284533722&rlsatarget=pla-4580840328168117&abcId=9300372&merchantid=51291&msclkid=52c16af1ba571d52ddfe35755ba68854
GPS:
https://www.bidorbuy.co.za/item/319275677/GYGPSV5_NEO_M8N_NEO_M8N_001_GPS_Chip_Module_for_APM2_6_Flight_Control.html
(The "<#include SoftwareSerial.h>" in the code below is what was added when I used the Arduino IDE's drop down libraries menu when I selected espsoftwareserial to include.)
Here is the (.ino) code:
#include <SoftwareSerial.h>

#include "Ublox.h"
#define SERIAL_BAUD 115200
#define GPS_BAUD 9600
#define N_INTS 4
//gpsSerial(3,1);
Ublox M8_Gps;
// Altitude - Latitude - Longitude - N Satellites
int gpsArray[N_INTS] = {0, 0, 0, 0};
SoftwareSerial gpsSerial;

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

void setup() {
Serial.begin(SERIAL_BAUD);
gpsSerial.begin(GPS_BAUD,SWSERIAL_8N1,3,1);
//gpsSerial.begin(GPS_BAUD);
pinMode(0,OUTPUT);
}
///////////////////////////////////////////////////////////
void loop() {
digitalWrite(0,LOW);
if(!gpsSerial.available()){
    Serial.print("Problem with GPS ");
}
while(gpsSerial.available()){
    char c = gpsSerial.read();
     if (M8_Gps.encode(c)) {
      gpsArray[0] = M8_Gps.altitude;
      gpsArray[1] = M8_Gps.latitude;
      gpsArray[2] = M8_Gps.longitude;
      gpsArray[3] = M8_Gps.sats_in_use;
    }
 }
 for(byte i = 0; i < N_INTS; i++) {
 Serial.print(gpsArray[i], 10);Serial.print(" ");
 }
 Serial.println("");
 }


texts:
I'm working on a diy quadcopter (with my own code)and I'm having some problems with yaw. Is it possible to make it stable using Z axis of gyro, or do I have to use compass? I have not found this info anywhere on the Internet so any help would be nice.

Thanks!


texts: How to flash a NodeMCU (ESP8266) with an external FTDI programmer?

texts:
Hi my USB to UART bridge (CP2102) seems to be broken on one of my NodeMCU Dev Boards with ESP8266.
It seems to be just that specific board since all other boards that I have can be flashed without problems.
I have a FTDI Programmer like this one:
FTDI Programmer
Now I would like to flash the Nodemcu using the FTDI programmer but I'm not sure how to wire it up.
I know that those programmers cant power up the ESP8266 by itself thats why I would use a micro USB cable that doesnt have a data wire to power up the nodemcu.
This is how I would wire everything up:

Is this the correct way to wire up the programmer with the nodemcu? I want to be sure that nothing is going to mess up with the nodemcu or the programmer.
NodeMCU       FTDI
GND    ---->  GND
RX     ---->  TX
TX     ---->  RX


texts: What might be some reasons this MKRZero circuit and sketch fail to read frequency?

texts:
I've built the following circuit on my MKR Zero

I've also uploaded, compiled and deployed the code from the associated article (https://www.arduino.cc/en/Tutorial/AnalogToMidi) with no errors.

Note: I won't reproduce all the code here because you can see code listing at the previous link.

The main part of the loop never gets hit:

void loop() {
  float frequency = meter.getFrequency();

  if (frequency > 0)
  {
...

The frequency is never > 0 so the main body of code never gets hit.

What I've Tried

I put in a few extra Serial.println() calls and I know the loop code
is in fact running but as I've said frequency never seems to be > 0.
I also measured current in the circuit just to see if current is
flowing. (I only have a multimeter (no oscilliscope).
I measured voltage at a couple of places and read about 1.6V over
each of the 47K resistors (about 3V across both).
I measured current on op amp out 1 and it varied between .44mA and
.55mA as I turned the 10K pot.

I'm just wondering if there is anything that seems obviously wrong about the circuit or if there are some additional suggestions about what I might check to determine where the failure is.

Arduino.cc Circuits Are Sometimes Wrong

I know that at times these Arduino.cc provided circuits are incorrect and was wondering if something here is obviously wrong.

I don't know much about the lm358 and it seems curious to me that they have input on Input1 and output to A0 on Out2.

Additional Tests?

Also are there some additional tests (via multimeter) I could do to determine where the circuit may be failing?  Any suggestions?


texts: Connect Arduino Uno RX/TX to 3.3v NEO-M8N gps module

texts:
I'd like to connect an M8N gps module to an Arduino Uno. From what I understand

the Arduino pins 0-RX/1-TX work on 5V
the M8N RX/TX work on 3.3v
the sensor-TX sending to the Arduino-RX should work (3.3v is “good enough” to drive the Arduino-RX-pin)
the Arduino-TX sending to the sensor-RX is problematic because of the 5v (could break the sensor)
During USB-programming, the Arduino-RX sensor can be at 5v (so suddenly the current flows in the "wrong direction"- which could break the sensor)
A level-converter could be used to “translate” the voltages in each direction.

Assuming we don’t use a level-convertor

Could we use a schottky-diode (which as I understand blocks current in 1 direction) to block the 5V from the ArduinoRX going into the sensor?
But then the 3.3V from the sensor-TX would pass (correct direction ), but the diode will drop the voltage "a bit more"… is this still enough to drive the arduino RX-pin?
And it works, why not also use a schottky-diode to also protect the Arduino-TX to sensor-RX connection ( just to be safe, since some people were saying one some Arduino they needed to connect RX-RX and TX-TX to get the communication to work.. ? ).

As an alternative to the schottky ( or maybe in addition to it)
- Could we simply take 2 voltage dividers (for one for both RX-TX and TX-RX) ?

We can use a “resistive voltage divider” to lower the Arduino-TX 5v to 3.3 V
- I understand to get from 5V to 3.3V we need “x” and “2 * x” resistors-values, so e.g 1K Ohm and 2K Ohm… but how do I know which values would be appropriate ( I mean, we could also take 10K Ohm and 20K Ohm, would also lead to 5V to 3.3v) but at a different current (Amps)… ?

And what about a voltage-divider with a resistor and a capacitor (see https://en.wikipedia.org/wiki/Voltage_divider, low-pass RC filter)?
What would be appropriate values for that solution for the resistor and capacitor?

Please be patient, electronics-beginner here trying to make sense of this…


texts:
I made OLED timer/watch using Attiny85, but as internal clock isnt accurate i need external crystal. On Attiny85 im short on pins so i am switching to Attiny84 but i have problems to compile/upload same code to Attiny84. Even if i stay on Attiny84 8mhz internal clock as on Attiny85 i still cant compile.
Im using Arduino UNO as ISP.

Error what i have:

WDT_Time.cpp: In function 'void setup_watchdog(uint8_t)':
WDT_Time.cpp:272: error: 'WDTCR' was not declared in this scope
WDTCR |= (1 << WDCE) | (1 << WDE);
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
             from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:88,
             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
             from WDT_Time.cpp:12:
WDT_Time.cpp:276: error: 'PCIE' was not declared in this scope
   sbi(GIMSK, PCIE); // Turn on Pin Change interrupts (Tell Attiny85 we want to use pin change interrupts (can be any pin))
              ^
WDT_Time.cpp:276:3: note: in expansion of macro 'sbi'
   sbi(GIMSK, PCIE); // Turn on Pin Change interrupts (Tell Attiny85 we want to use pin change interrupts (can be any pin))
   ^
WDT_Time.cpp:277: error: 'PCMSK' was not declared in this scope
   sbi(PCMSK, PCINT3);
       ^
WDT_Time.cpp:277:3: note: in expansion of macro 'sbi'
   sbi(PCMSK, PCINT3);
   ^
'WDTCR' was not declared in this scope


texts:
Context

I currently have a Sonoff S20 plug that is acting up and needs to be reflashed. (Over the air updates arent working)
The S20 plug is based on an ESP8266 chip.

Reading the documentation it states that you need a FTDI serial programmer @ 3.3v to get it done.
Instructions below

https://github.com/arendst/Sonoff-Tasmota/wiki/Hardware-Preparation

I am looking at this programmer here

http://www.ebay.com.au/itm/FTDI-FT232RL-USB-to-TTL-Serial-Converter-Adapter-5V-and-3-3V-For-Arduino-RZ/371993408316?epid=4004086862&hash=item569c88f33c:g:tdkAAOSw5VFWMM31

Question

The ebay item states its 3.3v AND 5v, I cant see two pinouts that supply different voltages.  If I was going to power this from my PC USB port is this thing going to output 5v and damage the ESP?
How am I supposed to get 3.3V out while connected to my PC?


texts: Ultrasonic distance module works without connecting to gnd

texts: I have a (HCSR04) ultrasonic distance module connected to arduino , i have connected all the four pins of the module properly and its working fine , then when i pull off the wire which is connected to ground in arduino , the module works totally fine . How the module works without connecting its ground pin to arduino ground ?


texts: esp8266 cant make more than one request at time

texts:
i am trying to make a get request, read that request and make another request with that read value. i havent shown it in this code but i want to make a request inside in a request. is it possible to make a request without ending one, if its, how do i do that?

here is the code :

#include <ESP8266WiFi.h>

#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>

#define WIFI_SSID "ssid"
#define WIFI_PASSWORD "pw"

void conn();
void getreq();
void anothergetreq();

void setup() {
  conn();
  getreq();
}

void loop() {
}

void getreq() {
  std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
  client->setInsecure();
  HTTPClient http;

  http.begin(*client, "https://jsonplaceholder.typicode.com/users/1");

  int httpCode = http.GET();
  String payaload = http.getString();
  Serial.print("HTTP CODE: "); Serial.println(httpCode);
  Serial.print("PAYLOAD: "); Serial.println(payaload);
  //here i presume got the value from payload, and making another request with it
  anothergetreq("posts/1");
  http.end();

}
void anothergetreq(String p) {

  std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
  client->setInsecure();
  HTTPClient http;

  http.begin(*client, "https://jsonplaceholder.typicode.com/"+p);

  int httpCode = http.GET();
  String payaload = http.getString();

  Serial.print("HTTP CODE: "); Serial.println(httpCode);
  Serial.print("PAYLOAD: "); Serial.println(payaload);
  http.end();
}

void conn() {
  Serial.begin(9600);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("Connecting to Wi-Fi");
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print(".");
    delay(300);
  }
  Serial.println();
  Serial.print("Connected with IP: ");
  Serial.println(WiFi.localIP());
  Serial.println();
}

here is the output:

Connected with IP: 192.168.1.100

HTTP CODE: 200
PAYLOAD: {
  "id": 1,
  "name": "Leanne Graham",
  "username": "Bret",
  "email": "Sincere@april.biz",
  "address": {
    "street": "Kulas Light",
    "suite": "Apt. 556",
    "city": "Gwenborough",
    "zipcode": "92998-3874",
    "geo": {
      "lat": "-37.3159",
      "lng": "81.1496"
    }
  },
  "phone": "1-770-736-8031 x56442",
  "website": "hildegard.org",
  "company": {
    "name": "Romaguera-Crona",
    "catchPhrase": "Multi-layered client-server neural-net",
    "bs": "harness real-time e-markets"
  }
}
HTTP CODE: -1
PAYLOAD:


texts:
I've recently bought a CJMCU-116 sensor equipped with MPU9250. It features magnetometer, accelerometer and gyroscope. It uses I2C for communication.
I've scouted everywhere but I could not find any library to make it work properly, just one that seems to work but I'm not 100% sure.
Can someone point me to the right direction, please?
 I'm using this library
found here. I know this is not the same sensor but the chip is the same, so it should work, am I right?


texts: Esp8266 firmware update with uno "chip sync error"

texts:
I have an ESP8266-01. I followed the instructions on this

http://yaab-arduino.blogspot.com/2015/12/flashing-esp8266-firmware-arduino.html?m=1

exactly. When I start the firmware update the TX and RX pins blink rapidly along with the blue light on the ESP.

Then the terminal spits out "chip sync error" and disconnects.

I would like this to work because buying a ftdi cable isn't an option right now.


texts: Arduino nano select port option is blurred | Driver issue

texts:
I have just bought arduino nano board. when i connect the board via usb, system detects the new device but i am not able to select port in arduino ide for writing any code on board. I checked my device manager it says

The drivers for this device are not installed. (Code 28)
There are no compatible drivers for this device.

I have also updated my board and library list in arduino ide.
please help me out?


texts:
I am using Adafruit Feather RFM69HCW Microcontroller. I am having difficulty uploading code in any Adafruit Feather boards. We have a project that is live on the field and it needs code changes. I have tried everything from holding the reset button while uploading, uploading the basic Blink function, changing USB micro cables, using different Adafruit Feather Boards.

However, I am assuming it has something to do with the Adafruit drivers.

I would really appreciate it if anybody can help me figure out the problem here.


texts: Will it work ? MPU6050 Gyro etc. etc. module

texts:
Will this code read the values properly ?
Using MPU6050.h.

#include <MPU6050.h>
#include <Wire.h>

void setup() {
  Serial.begin(115200);
  Wire.begin();
  MPU6050.initialize();
}

void loop() {
  MPU6050.getWaitForExternalSensorEnabled();
  float X = getRotationX();
  float Y = getRotationY();
  float Z = getRotationZ();
  Serial.print("X:");
  Serial.println(X);
  Serial.print("Y:");
  Serial.println(Y);
  Serial.print("Z:");
  Serial.println(Z);
}

Please be patient. I know nothing about gyroscope's working.
I'm stupid.


texts: Control Arduino through ethernet. How to contact from outside network and securely

texts:
I'm new to Arduino so please bear with me if my question is too simple or broad (I did try and research it) or guide me if it belongs elsewhere (networking forum?)

I would like to be able to control my Arduino remotely.  By remotely, I mean I would like to be able to access it over the internet.  I've done some research and know about the Arduino Ethernet Sheild (see:  How can I connect to an Arduino using WiFi?)

But I'm a newbie and it's not clear to me how I'm going to make my device "discoverable" from outside my local network.  I gather it involves "opening a port on my router"  Can someone expand on this or provide an example/tutorial? If I can do this, it would also be nice if there was some security so that not just anyone could control my robotic killer dog or whatever :).  I would think these are both common desires,  and there is probably tons of material (maybe even tutorials) but perhaps because I'm new to Arduino, I'm having a hard time finding material.

I thought a nice first step would be to have my Arduino Uno board connected to a single LED.  If I could then have a simple webservice on it, I could connect via my phone from work with a http post request.  Of course, I'd need someone at home to verify the led went on/off (or set up a camera for remote access).

Let me know if I can provide more detail or clarifications.  And Thank you!

Dave


texts: How to multitask while writing on Serial

texts: I am trying to send real-time data taken from an ADC by Arduino Uno (SPI) to Arduino IDE through a USB cable. I found that one byte takes around 70 microseconds when Serial.write() is used at a baud rate of 115200. My question is that if I send 14400 bytes (which would be the maximum limit at this baud rate), can I perform any other tasks? Does Arduino allow multitasking while the serial buffer is busy writing data?


texts: It is possible to control brightness of an LED strip (connected using a relay and having a seperate power supply ) using output from an arduino?

texts:
The circuit contains a relay interfacing with 12v power supply and LED strip. Can the brightness for this strip of LEDs be controlled using the analogWrite command?
This works perfectly for a single LED, but when i replace the LED with a relayed LED strip with its own adapter, it doesnt produce any perceivable output


texts:
I have Arduino Mega and Weather shield and GPS Receiver - GP-635T (50 Channel).

here is my code for GPS

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

TinyGPSPlus gps;

static const int RXPin = 5, TXPin = 4;
SoftwareSerial ss(RXPin, TXPin);

const byte GPS_PWRCTL = 6;

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

  pinMode(GPS_PWRCTL, OUTPUT);
  digitalWrite(GPS_PWRCTL, HIGH);
}

void loop()
{
  smartdelay(800);
}

And print weather with this code

void printWeather()
{
  Serial.print("lat=");
  Serial.print(gps.location.lat(), 6);
  Serial.print("lat=");
  Serial.print(gps.location.lng(), 6);
  Serial.print("altitude=");
  Serial.print(gps.altitude.meters());
  Serial.print("sats=");
  Serial.print(gps.satellites.value());

  char sz[32];
  Serial.print("date=");
  sprintf(sz, "%02d/%02d/%02d", gps.date.month(), gps.date.day(),gps.date.year());
  Serial.print(sz);

  Serial.print("time=");
  sprintf(sz, "%02d:%02d:%02d", gps.time.hour(), gps.time.minute(), gps.time.second());
  Serial.print(sz);
}

But I see only zero for location and date and time. What should I do?


texts: Short Occuring Between Digital IO Pins on Arduino ZERO

texts:
I have a couple custom SAMD21 boards (similar to Arduino Zero) connected to a screen from which I am trying to read PWM screen touch signals.
The two boards are identical - same components and same setup. The PWM lines are run from the MCU to a connector and then to the screen. There are no components on the PWM line (there can be an optional ESD suppresor but I have unmounted it for now).
On one board, I do not experience any problems - the screen works, touch signals are received and processed accordingly.
On the other board, the PWM does not work at all, in fact, the digital pins used to control it do not work at all. The PWM lines are hooked up at PA04 (Digital Pin 17) and PB09 (Digital Pin 15). When I try to write a value (high or low) to one of these registers, the code freezes. When I remove the screen, the problem goes away.

I set up an example, which just involves writing a HIGH signal to one pin and a LOW signal to the other.
So I took the two PWM pins (15 and 17) and connected them with a 220ohm resistor. On the functioning board, everything works, the code completes, and I read about 1.3V between the two.

But on the bad board, using the same setup with the 220ohm resistor, the board freezes in the same way as with the screen. Removing the connection (including the resistor) clears the error.

Is there a way inside the firmware to correct this? The operation is so simple and it freezes even when I try to write directly to the register - meaning I can't check the rdy bit for completeness while the pointer operation is not complete. Should hardware components be added the digital IO lines? I am unclear on how to proceed given that one identical setup works and the other does not.

Thank you very much for any help!

void setup() {

  uint8_t _yp = 18; //PB08
  uint8_t _ym = 16; //PA05
  uint8_t _xp = 17; //PA04
  uint8_t _xm = 15; //PB09

  SerialUSB.begin(115200);
  while (!SerialUSB);
  SerialUSB.println("Serial initialized...");

  pinMode(_yp, INPUT);
  pinMode(_ym, INPUT);
  pinMode(_xp, OUTPUT);
  pinMode(_xm, OUTPUT);

  SerialUSB.println("pinMode set successful");

  SerialUSB.println("Write xp high");
  digitalWrite(_xp, HIGH);
  SerialUSB.println("Write xm low");
  digitalWrite(_xm, LOW);

  SerialUSB.println("Finished");
}

void loop() {
}


texts: Arduino and ESP8266 Two-way Communication

texts:
I've searched the internet quite a bit and all I find is how to make two esp8266 communicate. What I am trying to do is connect a single esp8266 to the arduino and have a two-way communication between them.

I want to send and receive data on both the Arduino and ESP8266. The concept is to send data to the esp8266 over WiFi connection and then send that data to the Arduino. The Arduino will manipulate it and send it back over WiFi.

I feel like this would be a common beginner example to have a two-way communication over a TX/RX connection, but I can't seem to find any. All examples I find are strictly one as sender and other as receiver.


texts: I have built a battery level indicator and have tested with a 12V battery Would it harm my arduino board if I connect a 48V battery?

texts:
I am a newbie and have followed a tutorial to build a battery level indicator as below

Please suggest any changes I'll need to make to make the circuit useful with a 48V battery as the above circuit is tested with a 12V one.
Thank You.