texts: My daughter has a chromebox she uses for all her email/homework/etc.  We've started to get into making ADABOX projects and I was looking for best options for chromebook users.  I saw that codebender was shutting down.  And Chromeduino looks like it might have problems with libraries.  Currently I am looking to just set her up with a Raspberry Pi she can connect to with her chromebox and use it to connect to the Arduinos/Feathers, since I know she will need libraries and things from adafruit.  But I was hoping there might be newer options I haven't found yet.


texts: I'm trying to make a RC car (with a surveillance camera if possible, using the web-cam code that comes with the ESP library) using a ESP-32 CAM as a wifi module to control the car using my computer. Problem is that I keep getting the "invalid head of packet" error whenever I try uploading anything. I've tried holding the boot button as I upload and I cannot use the capacitor simply because I don't have it and don't want to buy it and spend time getting it. I also have the GPIO0 pin connected to GND during the uploading process. Any other ways to get it working? My car consists of 2 DC motors powering only the back two wheels and a servo that steers the front wheels, and I want to use the ESP32-CAM to connect to wifi to connect to a webserver from my pc to control the car.


texts: Communication between two slaves via single SPI bus

texts:
I am trying to control both RC522 and lcd st7920 (128x64) via a single SPI bus on the NodeMCU esp8266. I am using Arduino core for my esp8266. Now in this portion of the code, I only want to display the UID of the card on the lcd each time a card is scanned on the RC522. The code is as follows:
#include <SPI.h>
#include <MFRC522.h>
#include <U8g2lib.h>

#define SPI_SCK_pin       14  // Clock pin of SPI
#define SPI_MOSI_pin      13  // MOSI pin of SPI

#define SPI_RST_pin       0   // RST-PIN for RC522 - RFID - SPI - Modul GPIO5
#define SPI_rfid_SS_pin   15  // SDA-PIN for RC522 - RFID - SPI - Modul GPIO4
MFRC522 mfrc522(SPI_rfid_SS_pin, SPI_RST_pin); // Create MFRC522 instance

#define SPI_lcd_SS_pin    5   // Slave Select pin of SPI for lcd<->RS
U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R2, SPI_SCK_pin, SPI_MOSI_pin, SPI_lcd_SS_pin, U8X8_PIN_NONE);

void setup() {
  SPI.begin();           // Init SPI bus
  Serial.begin(115200);    // Initialize serial communications

  u8g2.setFont(u8g2_font_amstrad_cpc_extended_8f);
}

void loop() {

  mfrc522.PCD_Init();    // Init MFRC522
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    delay(50);
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    delay(50);
    return;
  }

  Serial.print(F("Card UID:"));
  String uid = dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
  Serial.println();
  digitalWrite(SPI_rfid_SS_pin, HIGH);   //return rfid slave pin back to normal

  u8g2.begin();
  u8g2.clearBuffer();
  u8g2.setCursor(3,10);
  u8g2.print (uid);
  u8g2.sendBuffer();
  digitalWrite(SPI_lcd_SS_pin, HIGH);   //return lcd slave pin back to normal
//  delay (10);

}

// Helper routine to dump a byte array as hex values to Serial
String dump_byte_array(byte *buffer, byte bufferSize) {
  String userid;
  for (byte i = 0; i < bufferSize; i++) {
      userid += String(buffer[i]);
  }
  Serial.print(userid);
  return userid;
}

I am new to using the esp8266 and this is my first time using multiple slaves on a single SPI bus so I may not know the correct way to using multiple slaves. I tried connecting only the rfid rc522 with esp8266 via SPI and it worked flawlessly with the schematic. Similarly the lcd also works flawlessly individually on the SPI bus with the same schematic.
The issue only exists if I try to connect both via SPI. The problem is that only the first time a card is scanned, is it displayed on the lcd. After that no more cards are scanned and the only the first card scanned is displayed on the lcd.
What I am trying to do is that every time a card is scanned, its UID be displayed on the lcd. I've posted the schematic and my actual setup which you can check.


texts:
I have a LCD connected to a Arduino Mega 2560 using the instructions in LiquidCrystal library. It is not the first time I am using a 16x2 LCD but I never have encountered a problem like this. When I first connect the Arduino Mega to PC I see a row of blocks in first row of LCD which looks like normal to me. Then after that there is a block of white under each character.

Now I have searched a little and saw whole blocks which was due to bad soldering or bad wiring or etc. I have checked soldering and wiring twice. used 3 different LCD's and 2 different Mega's and it is still the same.

Any suggestions?

These are the images from when I turn it on:

[SOLVED] Update :

Looks like the POT was broken and did not respond the way it used to. So i replaced V0 with a 2.5k resistor and connected them to GND.
Here is the updated image :


texts: Attiny85 PB4 works for analog output but not PB3?

texts:
I can get PB4 to work but not PB3 on my ATtinny85.  I'm just lighting up an led (with 150 ohm resistor) (using internal 16mhz)

void setup() {
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);

}
void loop() {
  analogWrite(3, 15);//does not work
  analogWrite(4, 15);//works
  delay(500);
  analogWrite(3, 0);//does not work
  analogWrite(4, 0);//works
  delay(500);
}


texts: Strange artifact in writing to serial while executing loop

texts:
Hope you can see this.

https://gist.github.com/DevilWAH/60ad144d2858f53845ac2e80f84bb070

The main file in this is "morse-led-rfid" which is taking reading data of an RFID tag and then displaying the text as Morse code on to a APA102 / Dotstar LED strip.

The issue is when the function updatestrip(tempbuffer[i]); is called.

Serial.println(F("\n**Start Reading**\n"));

  for (uint8_t i = 1; i < 15; i++)
  {
   if (i != 3 && i!= 7 && i != 11 && i != 15 ) // Skip the non data blocks
    {
     readblock (i, key);
       for (uint8_t i = 0; i < 16; i++)
         {
      updatestrip(tempbuffer[i]);
      Serial.write(tempbuffer[i]);
        }
    }
  }

This is what I am calling to scroll the LED strip and write the letter in morse. if in the code snip it above i comment out "updatestrip...." then i get the txt from the RFID tag printer to serial as i would expect.

as a soon as i un comment it, the strip displays the morse code but the serial output gets garbled, it misses letters, prints reversed "?'s" and repeats its self?

Good output = "My Bunny is the best"
Bad output = "?Bunny is the ?t" (question marks reversed)

Further investigation i found if i leave it uncommented but go all the way to the bottom of the "more-strip" sheet and comment out the "else statement in the shiftLED function" the serial again displays correctly, but of course the led don't :)

void shiftLED() // shift all LED up 1
  {
    for(uint16_t i = ledCount; i > 0; i--)
    {

      if ((colors[i - 1].red == 0 ) && (colors[i - 1].green == 0 ))
       {
          colors[i] = cblack;
        }
      else if (i > 19 && i < 40)
      {
        colors[i] = cred;
      }
     // else
     // {
     //   colors[i] = cgreen;
     // }
     // }

 }

Can any one suggest why the else statement a few function down is affecting the "serial.write(tempbuffer[i])" in the main loop?


texts: Sending Analog Input Data from Serial Port to Google Sheets

texts:
So I'm trying to make use of my Arduino Uno while I purchase the components for my next project.

I've made use of the Digital Hourglass project from the Starter Kit to make sure I get up and move around every 20 minutes while I'm at home. A temperature sensor was included in the Starter Kit as well, so I figured I might as well make use of it since I have extra I/O pins.

I wrote the code for in the Arduino IDE to display the temperature and the current time. I'm using: #include (Time.h) to also show the current time. I have two questions.

End Goal:

A Google spreadsheet (Cloud) that I can access anywhere that can show me the temperature of my apartment throughout the day. I can track how the trend changes over time through the day, week, or month.

What is the best way to output the current time; as seconds since 1970 (Unix time) or date and time format? I guess it's a preference.
How do I output the data from the Arduino serial port directly to Google Sheets? That may be difficult, so the other option is to energize the Arduino in the morning and remove power at the end of the day, output the Serial port to a .txt file, and then import into Google sheets. How do I do this?


texts:
I'm developing a program to calculate static margin of an aircraft through the calculations of mass,moment and arm. Essentially dealing with large numbers.

I'm having difficulty in setting up my code in the way so that the arithmetic is applied correctly to larger numbers. What I have so far works but only when the input is 0-9. The arithmetic fails to calculate digits beyond.

I understand that I'm breaking the digits into separate variables as to convert them from ASCII format to their intended value. The problem is in putting those digits back together.

I know this is probably very simple but I'm picking up arduino again after a long break and I'm very rusty.

Here's my code thus far:

long batterymoment,num1,num2,answer;
int batterymass = 720;
int batteryposition;
boolean mySwitch = false;

void setup() {
  Serial.begin(9600);
  num1=0;
  num2=0;
  Serial.println("Enter battery position");
}

void loop() {
  while (Serial.available()){
   batteryposition = Serial.read();

   if(batteryposition>47 && batteryposition<58){
     if(!mySwitch){
       num1=(num1*10)+(batteryposition-48);
     }else{
       num2=(num2*10)+(batteryposition-48);
     }
   }

   answer=num1+num2;
   batterymoment=answer*batterymass;
   Serial.print("Battery moment is: ");
   Serial.println(batterymoment);
   num1=0;
   num1=0;
   mySwitch=false;
  }
}

Thanks.


texts:
I am new to Arduino and I'm trying my first Pro Mini. I was able to find DS1302 code from github that runs perfectly. My problem is trying to add some LM35 code to also display temperature data as well as the time data.

The code doesn't seem to run the Celsius and Fahrenheit functions. I have attached my code. Any help will be appreciated.

//Required library - http://www.rinkydinkelectronics.com/library.php?id=5
//Blog Post - http://overskill.alexshu.com/ds1302-real-time-clock-w-arduino/

#include "U8glib.h"
#include <DS1302.h>
#include <PreciseLM35.h>
//int float pinLM35 = A0;
const int pinLM35 = A0;
PreciseLM35 lm35(pinLM35, DEFAULT);

DS1302 rtc(2, 3, 4);
U8GLIB_ST7920_128X64 u8g(13, 11, 12, U8G_PIN_NONE);

void setup(void) {
  rtc.halt(false);
  rtc.writeProtect(false);

  // The following lines can be commented out to use the values already stored in the DS1302
  // Once you flash the Arduino with the correct time.

  //rtc.setDOW(FRIDAY); // Set Day-of-Week to FRIDAY
  //rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(6, 8, 2010); // Set the date to August 6th, 2010

  // assign default color value
  if (u8g.getMode() == U8G_MODE_R3G3B2)
    u8g.setColorIndex(255); // white
  else if (u8g.getMode() == U8G_MODE_GRAY2BIT)
    u8g.setColorIndex(3); // max intensity
  else if (u8g.getMode() == U8G_MODE_BW)
    u8g.setColorIndex(1); // pixel on
}

void draw(void) {
  u8g.setFont(u8g_font_04b_03);
  u8g.drawStr( 2,5, "******************************");
  u8g.drawStr( 13,10, "Arduino Pro Mini Control ");
  u8g.drawStr( 24,20, (rtc.getTimeStr()));
  u8g.drawStr( 1,20, "TIME: ");
  u8g.drawStr(70,20,  "Temp (C): ");
  u8g.drawStr (80,20, (lm35.readCelsius()));
  u8g.drawStr( 25,30, rtc.getDOWStr());
  u8g.drawStr(70,30, "Temp (F): ");
  u8g.drawStr(3,30, "DAY: ");
  u8g.drawStr(80,30, (lm35.readFahrenheit()));
  u8g.drawStr( 24,40, rtc.getDateStr());
  u8g.drawStr(1,40, "DATE: ");
  u8g.drawStr(70,40, "AREF : ");
  u8g.drawStr(80,40, (lm35.readPreciseAref()));
  u8g.drawStr( 15,55, "DS1302 Real Time Clock");
  u8g.drawStr( 2,65, "********************************");
}

void loop(void) {
  // picture loop
  u8g.firstPage();
  do {
    draw();
  } while(u8g.nextPage()); //u8g.nextPage()
  // rebuild the picture after some delay
  delay(500);
}


texts: Small Arduino with Bluetooth HID interface

texts:
I am trying to create a bluetooth gamepad for my phone.

I saw this:

https://www.amazon.com/DFRobot-Beetle-BLE-Arduino-Bluetooth/dp/B014KQHEH6/ref=cm_cr_arp_d_product_top?ie=UTF8

It says its bluetooth HID, but there are some conflicting comments saying it is serial over bluetooth. Is there something similar in a small form factor with an hid bluetooth module that I can use?


texts: How to convert Arduino example sketch to a complete c++ project?

texts: I'm experimenting something new with my Arduino Leonardo. I removed its original bootloader and flashed it with LUFA mass storage example with added functionalities(now its a firmware). I'm trying to now add RFID reader(read/write) example to my firmware. For that I have to convert the sketch to a c++ code. So I copied relevant header file and cpp file from the library folder(libraries->rfid-master->bla.h,bla.cpp). But I'm confused what to do with the .ino file under examples(libraries->rfid-master->examples->ReadAndWrite->blabla.ino). I guess this code should be copied to the main class of my firmware. Any ideas?


texts:
For a research type project, we are looking for a very accurate and sensitive accelerometer (preferably 6-axis). The average range of the acceleration that we need to record is about 0.0003g (g=gravitational acceleration=9.81m/s2). The minimum sampling rate of measurements should be about 250Hz. We have no electronic engineering background and so we are looking for a readily available module that can be simply installed and connected to a data processor (eg Raspberry pi or a similar one) for recording data. we need to use these sensors for one of our mechanical engineering projects.
Your comments and help are appreciated.
Thanks.
M.


texts: Nano-like Board - Programmer Not Responding

texts:
I am trying to upload a basic sketch to my unofficial Nano-like board and keep getting this error. I understand that it is a generic connection error between the Arduino and my PC, but can't figure out why it is having this problem.

Semi-compatible nano-like board
Drivers
Arduino IDE 1.8.3 freshly installed
Windows 10 64-bit
Also tried on Mac OSX with the same result

I've looked up the drivers from the manufacturer's website and installed them, and the Arduino Nano shows up just fine under my Device Manager. The green power light comes on, it is recognized by my PC, and blue flashing 'L' light blinks, making me think that the manufacturer had uploaded the Blink sketch to test it. However, when I try to upload a sketch from the IDE I get this error:

avrdude: stk500_recv(): programmer is not responding

Under 'Tools" I have the board set to 'Arduino Nano', the processor set to 'ATmega168' and the port the same COM port as what it's listed as in Device Manager. Assuming that all of those are correct, I have tried a few things with no luck:

Reinstalling the IDE, drivers and restarting my computer.
Letting Windows find its own driver.
Pressing the 'reset' button just before hitting 'upload' in the IDE
Using different micro USB cables and USB ports on my computer.

Any other ideas or is the unit possibly just faulty?

Please note that I have already at similar questions and tried a bunch of their suggestions with no luck.


texts: There are two ways of pulling the pins in Arduino – using internal and external resistor. I wonder when I should use external resistor instead of INPUT_PULLUP.


texts:
I'm having a problem trying to run a bunch of code, using an "if" state which uses a variable which should get a value from a soil moisture sensor.

I'm using the sensor digitally, so it should just sense a value between the 2 discrete "0" and "1". However, even if I think my code is ok, it simply doesn't work, as the value is always "0"(default value is 0 for the global variable "sms" i use). The code I'm posting below is without an "else" state that is following the first "if". But my problem is inside the first "if" state. Please note that jumper wires are ok and also I've tried 3 different soil moisture sensors, two of which were brand new. Any ideas on what's wrong?

//Start of program

char auth[] = "**************";
char ssid[] = "88888";
char pass[] = "99999999";

int Relay1 = D1;
int Relay2 = D2;
int val2;
float val3;
int sensor_pin = D7;
int pinValue;
SimpleTimer timer;
elapsedMillis timeElapsed;
DHT dht(DHTPIN, DHTTYPE);
NewPing sonar2(TRIGGER_PIN2, ECHO_PIN2, MAX_DISTANCE2);

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

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

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

void loop()
{
  Blynk.run();
  timer.run();
  if (pinValue == 0)
  {
    some code here
    sms=digitalRead(sensor_pin);
    if ( sms == 0)
    {
      if (val2 <= 14)
      {
        code here          }
      else
      {
        digitalWrite(Relay2, LOW); // Pump2 ON
        delay(500);

      }
    }
    else //(sms == 1)
    {
      some code here
    }
  }


texts: Help with Receiver / Transmitter (nRF24L01+)

texts:
Dear fellow Arduino users,

My two friends and I are having trouble on an Arduino project we are working on. We are using two Arduino Uno's and trying to have one of them send a signal to another one by a press of a button using NF24L01+ (with the antenna). Our transmitter code is as follows:

// create an RF24 object
RF24 radio(9, 8);  // CE, CSN

// the number of the pushbutton pin
const int buttonPin = 3;

// variable for reading the pushbutton status
int buttonState = 0;

//address through which two modules communicate.
const byte address[6] = "00001";

void setup()
{
  Serial.begin(9600);
  Serial.println("nrf24L01+ Transmitter Starting!\n");

// initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);

radio.begin();
  radio.setRetries(15, 15);

//set the address
  radio.openWritingPipe(address);

radio.setPALevel(RF24_PA_MAX);

//Set module as transmitter
  radio.stopListening();
}

void loop()
{
  buttonState = digitalRead(buttonPin);

if (buttonState == 1) {
    Serial.write("Sending the following message: \n");

//Send message to receiver
const char text[] = "\t Hello, friend!";
Serial.write(text);
Serial.write("\n\n");

radio.write(&text, sizeof(text));

delay(1000);

}
}

On the receiver side, we have the following:

//create an RF24 object
RF24 radio(9, 8);  // CE, CSN

//address through which two modules communicate.
const byte address[6] = "00001";

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

  radio.begin();

  //set the address
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MAX);

  //Set module as receiver
  radio.startListening();
}

void loop()
{
  //Read the data if available in buffer
  if (radio.available())
  {
    Serial.print("hello");
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);
  }
}

However, we are not receiving any signal on the receiving end. We are pretty sure all our pins are correct. We are wondering if anyone had any advice on how we could troubleshoot. Thank you.


texts:
I trying to use a new sensor the KMX63 with a Arduino Uno board, my sensor is on a evaluation board made by kionix.
For the connexion il linked as follows:
| Pin Uno | Pin evaluation board |
| A5 | 5 |
| A4 | 7 |
| 3.3 | 1 |
| GND | 8 |
Here the schematic of the evaluation board:

I found a technical note from the constructor that advice to do some steps after the power up of the sensor to insure it's well functioning I wrote a code following it:

#include <Wire.h>
#include "KMX62.h"

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

  Serial.println(F("Starting"));

  byte error=7;
  byte id=0;
  byte command=0;
  delay(60);
  Wire.beginTransmission(KMX62_I2C_ADD_2);
  Wire.write(0x7F);
  Serial.println(F("Write 0x7F"));
  Wire.write(0x00);
  Serial.println(F("Write 0x00"));
  delay(100);
  error=Wire.endTransmission();
  Serial.print(F("retour 1 : "));
  Serial.println(error);
  if( error==0 ){
    Wire.beginTransmission(KMX62_I2C_ADD_2);
    Wire.write(CNTL2);
    Wire.write(0x00);
    error=Wire.endTransmission();
    if( error==0 ){
      Wire.beginTransmission(KMX62_I2C_ADD_2);
      Wire.write(CNTL1);
      Wire.write(0x80);
      error=Wire.endTransmission();
      if(error==0){
        delay(5);
        Wire.beginTransmission(KMX62_I2C_ADD_2);
        Wire.write(WHO_AM_I);
        Wire.endTransmission(false);
        Wire.requestFrom(KMX62_I2C_ADD_2,1);
        id=Wire.read();
        error=Wire.endTransmission();
        if(id==0x18||id==0x2D){
          Wire.beginTransmission(KMX62_I2C_ADD_2);
          Wire.write(COTR);
          Wire.endTransmission(false);
          Wire.requestFrom(KMX62_I2C_ADD_2,1);
          command=Wire.read();
          error=Wire.endTransmission();
          if(command==0x55){
            Serial.println(F("device ok"));
          }else{
            Serial.println(F("Issue with the sensor step e : need to be rebooted"));
          }
        }else{
          Serial.println(F("Issue with the sensor step d id=wrong : need to be rebooted"));
        }
      }else{
        if(error==2||error==3){
        Serial.println(F("Issue with the sensor step c : need to be rebooted"));
        }
      }
    }else{
      if(error==2||error==3){
        Serial.println(F("Issue with the sensor step b : need to be rebooted"));
      }
    }
  }
}

void loop(){

}

but i have an issue the steps , the program seem to freeze when i try to write into the register 0x7F.
I don't get any trace that i should have after the wire.endtransmission().
Here the trace i obtain :
09:56:35.477 -> Starting
09:56:35.511 -> Write 0x7F
09:56:35.511 -> Write 0x00

i have use the I2C scanner to check if the sensor appear, i had to modify the scanner to add a delay before Wire.beginTransmission and the Wire.endTransmission to avoid the scanner to be freeze too at the first address tried. After the modification i did saw the sensor at the address it was mean to be.
here the trace for the I2C scanner :
Scanning...
I2C device found at address 0x0F  !
done

Anyone have an idea of why i can't write anything to my sensor without making my program freeze indefinitely each time ?
PS : After the advice of chrisl i rerunned all my programs on a arduino mini pro on 3.3V / 8Mhz and got the same result.


texts: What is the best Arduino board for a Quadcopter with camera and Wifi?

texts: I need to design a Quadcopter that contains a camera , ultrasonic sensors and Wifi connection to broadcast images in order to do image processing on a computer


texts:
I cannot upload my sketch to my arduino DUE.

I get this error:

Send auto-baud
No device found on COM8
Set binary mode
An error occurred while uploading the sketch

The IDE recognizes thought that port 8 is the DUE programming port. Also i get a response when i press "Get Board Info".

After searching online, i found out it has to do with my baud rate.
So i use the "mode" command in windows and the baud rate is 115200.

So i use this command:

mode com8:1200,n,8,1

When i retype mode, then indeed, COM8 is at 1200 baud.
Then i try to reupload and it fails yet again!

So i retype "mode" and COM8 is back to 115200.

So i think the IDE resets the baud rate to that value.

Any clue on what to do?


texts: Problem with interfacing Cirus OS1 oxygen sensor with Arduio Uno

texts:
I am trying to interface Arduino UNO with Cirus OS1 oxygen sensor but not able to get the expected output. The expected voltage output of OS1 sensor is 9-13mV and the oxygen % is expected to be in the range 19-21 %.
I am using the code :
void setup()

{

     Serial.begin(9600);
     analogReference(INTERNAL);
}

void loop()
{

     const float A_REF = 1.1e3;
     const float Sensor_Cal = 1 / 0.6;
     int sensorValue = analogRead(A0);
     float voltage = sensorValue *(A_REF / 1024);
     float oxygen = voltage * Sensor_Cal;
     Serial.print(" Voltage in mV : ");
     Serial.print(voltage);
     Serial.print("  ");
     Serial.print(" Oxygen level in % : ");
     Serial.println(oxygen);
     delay(1000);
}

However, I am getting an output :

I am using Cirus OS1 oxygen sensor - https://www.biometriccables.in/collections/oxygen-sensors/products/oxygen-sensor-os1
Expected voltage range - 9mV to 13mV
Expected oxygen % - 19 to 21 %
Have tried using LM324N opamp, but it's still not giving expected output. Kindly help or suggestions are welcome.


texts:
Arduino does not recommend to program the Due board via Native port  as it is not reliable:

If the MCU crashed for some reason it is likely that the soft erase procedure won't work as this procedure happens entirely in software on the SAM3X

Unfortunately Arduino doesn't say what is crash and how to solve this issue if your home made Due has only the Native port.

I have only several assumptions but not sure that they are correct.

The Arduino Due boot-loader starts only if the Flash is not programmed. If the code is programmed to the flash but is damaged the boot-loader will not
start. As the MCU is hanged it can not erase the flash.

What can be done in this situation?

Just push the erase button on the board. It will the erase the content of the memory and allow boot-loader to start.

Now the programming via the Native port should be possible.

Please correct me if I'm wrong.


texts: At dimming = 128, suddenly voltage goes up to 240 volt and then back to 0 volt

texts:
While using dimmer circuit with esp8266, at dimming = 128, suddenly voltage goes up to 240 volt and then back to 0 volt. at the output inductive load is connected like TABLE FAN , it has not any type of adapter, its AC line device.

where, the dimming range is 0-128 .
0=ON (no power clipping) means load should be ON.
128=OFF means load should be OFF.

Is this happens with dimmer circuit normally while load connected [TABLE FAN] or I am doing something wrong?
Also , can we use this value(128) for switching purpose? --means whenever we put the dimming=128 the load will be stay OFF,and power consumption stops towards load, as switch works.

i am newbie and trying esp8266 dimmer for first time.

here , the line voltage is 230-240 volts AC, 50Hz power supply .

I am referring this circuit as it is and code also, only the change is dimming value taken using serial communication

here i am using inductive load (TABLE FAN).

`

  const int interruptPin = 14;
int AC_LOAD = 4;    // Output to Opto Triac pin
int dimming = 128;  // Dimming level (0-128)  0 = ON, 128 = OFF

void setup()
{
  Serial.begin(115200);
  pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), zero_crosss_int, RISING);  // Choose the zero cross interrupt # from the table above
}

//the interrupt function must take no parameters and return nothing
void zero_crosss_int()  //function to be fired at the zero crossing to dim the light
{
  // Firing angle calculation : 1 full 50Hz wave =1/50=20ms
  // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle)
  // 10ms=10000us
  // (10000us - 10us) / 128 = 75 (Approx)

  int dimtime = (75 * dimming);  // For 60Hz =>65
  delayMicroseconds(dimtime);    // Wait till firing the TRIAC
  digitalWrite(AC_LOAD, HIGH);   // Fire the TRIAC
  delayMicroseconds(10);         // triac On propogation delay
  // (for 60Hz use 8.33) Some Triacs need a longer period
  digitalWrite(AC_LOAD, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
}

void loop()  {

   dimming = Serial.read(); // dimming value is taken from serial for
                               dimming the load

}`


texts: Connect a button to bluetooth board and comunicate with Android

texts:
I want to create a small device, just a button that sends its status to an Android application through Bluetooth.

I bought a Bluno Beetle, but the information it exposes to Bluetooth cannot be modified from Arduino code, so I have no way to send the button status to the Android App, rookie mistake I guess.

Could you please tell me which model of arduino+bluetooth should I purchase to do this ?


texts:
I'm trying to making a traffic light for my school project but my button for the traffic light doesn't work. The traffic lights should light up normally but when the button is pressed all LEDs should go to LOW but that does not happen. Did I connect my buttons incorrectly?
Code:
int Pins[] {2,3,4,5,6};
int red =2;
int yellow=3;
int green = 4;
int GruenF =6;
int RotF=5;

int blaulichtTaster = 12;
int blaulichtTasterStellung = 0;

void setup() {
  for(int i=0;i<9; i++) {
  pinMode(Pins[i], OUTPUT);
}
  pinMode(blaulichtTaster, INPUT);

}
void loop() {

  blaulichtTasterStellung = digitalRead(blaulichtTaster);

  if(blaulichtTasterStellung == 0){
    digitalWrite(red, HIGH);
  delay(3000);
  digitalWrite(GruenF, HIGH);
  digitalWrite(RotF,LOW);
  delay(4000);
  for(int i =0;i<4;i++) {
    digitalWrite(GruenF,LOW);
    delay(500);
    digitalWrite(GruenF,HIGH);
    delay(500);
  }
  digitalWrite(GruenF,LOW);
  digitalWrite(RotF, HIGH);
  delay(3000);
  digitalWrite(yellow,HIGH);
  delay(4000);
  digitalWrite(red,LOW);
  digitalWrite(yellow,LOW);
  digitalWrite(green, HIGH);
  delay(10000);
  digitalWrite(green, LOW);
  delay(500);
  for(int i = 0; i<3; i++) {
    digitalWrite(green, HIGH);
    delay(500);
    digitalWrite(green, LOW);
    delay(500);
  }
  digitalWrite(green, HIGH);
  delay(500);
  digitalWrite(green, LOW);
  digitalWrite(yellow, HIGH);
  delay(4000);
  digitalWrite(yellow, LOW);
  }

  else{
    digitalWrite(red,LOW);
    digitalWrite(yellow,LOW);
    digitalWrite(green,LOW);
    digitalWrite(RotF,LOW);
    digitalWrite(GruenF,LOW);
  }

}

My circuit:


texts: I'm working project which consist of 2 arduino running a 2 different sketch, However, can i make these 2 ic to run on same power +ve and same ground?


texts: Need help with nRF24L01 and Arduino decoding and receiving

texts:
A month ago I bought a Chinese drone, remotely controlled by: SM-217-BKT v5 controller, which uses 2.4GCOB-1A transmitter. My idea was to drive a drone with its "memory", I mean:

Start the drone and its controller.
Drive it and set it back to exactly the same position as on start.

Then to read/decode commands and after that execute/transmit them back to the drone without my help.

For the moment I know how to transmit the commands. I need to know the pipe to pair nRF24 with the receiver of the drone, to know the commands, again to know the pipe of the controlling transmitter.

I've got plan B.
To connect Arduino analog pins with the controller's joysticks, to analogRead them and than analogWrite them, but maybe this plan is not going ok.

Thanks for your time :)
1.EDIT
Under word "pipe" i mean variable which holds receiver's unique pattern of filtrating its controller's commands from other 2.4Ghz waves
2.EDIT or maybe there is a plan C, to remove the board from my drone and to use motors and frame, and than control it with another nrf24


texts: Arduino Micro: Why am I getting 6.00 as a result instead of 6.66?

texts:
Basically, on the TWR calculator page, when I entered 20 as the initial value and 3 as the value that comes after, I somehow get 6.00 as a result instead of 6.66 in the computeTWR() function. How can I fix this?
// ------------------- DIVIDER ---------------------
/*
   Jebediah's Launch Control System for Kerbal Space Program
   Alpha Build 1.1
   An Open-Source Project by John Seong
*/

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

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

char keys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}
};

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

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

// Show a two-line message on the LCD.
void lcdShow(const char *line0, const char *line1) {
  lcd.clear();
  lcd.print(line0);
  lcd.setCursor(0, 1);
  lcd.print(line1);
}

void computeTWR(int thrustR, int weightR) {
  float result = thrustR / weightR;
  lcd.print(result);
}

void setup() {
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcdShow("Jeb's Launch", "Control System");
  delay(3000);
  lcdShow("Alpha Build 1.1", " STUDIO HORIZON");
  delay(3000);
  lcdShow("Welcome, Kerman", "Press any key...");
  while (!keypad.getKey()) ;  // wait for key press
}

void loop() {
  static enum {START, MENU, SET_COUNT, COUNT_DOWN, SET_THRUST, SET_WEIGHT, TWR_COMPUTE} state = START;
  static uint32_t last_second;  // millis() value on last full second
  static int count, thrust, weight;             // countdown, thrust, weight value
  static float ratio;

  char key = keypad.getKey();

  switch (state) {
    case START:  // transitional state
      lcdShow("1. Countdown", "2. TWR");
      state = MENU;
    /* fallthrough */
    case MENU:
      if (key == '1') {  // Countdown
        lcdShow("Countdown Timer", "Seconds: ");
        count = 0;
        state = SET_COUNT;
      } else if (key == '2') {  // TWR
        lcdShow("TWR Calculator", "Thrust: ");
        thrust = 0, weight = 0, ratio = 0;
        state = SET_THRUST;
      }
      break;
    case SET_COUNT:
      if (key >= '0' && key <= '9' && count <= 99) {
        lcd.print(key);
        count = 10 * count + (key - '0');
      } else if (key == '#') {
        lcdShow("Lift off in", "     seconds");
        // Force a refresh on entering COUNT_DOWN:
        last_second = millis() - 1000;
        count++;
        state = COUNT_DOWN;
      } else if (key == '*') {
        state = START;
      }
      break;
    case COUNT_DOWN:
      if (millis() - last_second >= 1000) {
        last_second += 1000;
        count--;
        if (count == 0) {
          Serial.println("Lift off!");
        } else if (count < 0) {
          state = START;
          break;
        }
        lcd.setCursor(1, 1);
        lcd.print(count < 10 ? "  " : count < 100 ? " " : ""); // pad
        lcd.print(count);
      } else if (key == '*') {
        state = START;
      }
      break;
    case SET_THRUST:
      if (key >= '0' && key <= '9' && thrust <= 9999) {
        lcd.print(key);
        thrust = 10 * thrust + (key - '0');
      } else if (key == '#') {
        lcdShow("TWR Calculator", "Weight: ");
        state = SET_WEIGHT;
      } else if (key == '*') {
        state = START;
      }
      break;
    case SET_WEIGHT:
      if (key >= '0' && key <= '9' && weight <= 9999) {
        lcd.print(key);
        weight = 10 * weight + (key - '0');
      } else if (key == '#') {
        lcdShow("Thrust-to-weight", "ratio: ");
        computeTWR(thrust, weight);
      } else if (key == '*') {
        state = START;
      }
      break;
  }
}


texts: Should all unused analog input ports be tied to ground for accurate A2D measurements?

texts: I am using the A0 port on my Arduino Uno to read the voltage output from an LM35 temperature sensor.  I observed that the reading fluctuates a lot if I leave the remaining analog input ports A1 to A5 floating. Would floating analog inputs affect the accuracy of readings on input ports connected to some signals.


texts:
I have written a simple sketch that displays temperature and humidity on a 16x2 LCD. Here's its output:

Temp: 28▒▒
Humidity: 68▒▒

The library I used for DHT11 sensor is not from Adafruit. This is the sketch:

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include<dht.h>

#define DHT11_PIN 12
#define I2C_ADDR       0x3F
#define BACKLIGHT_PIN  3
#define En_pin         2
#define Rw_pin         1
#define Rs_pin         0
#define D4_pin         4
#define D5_pin         5
#define D6_pin         6
#define D7_pin         7
#define SCL_PIN        12
#define SDO_PIN        11

dht DHT;
LiquidCrystal_I2C  lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);

void setup() {
  pinMode(SCL_PIN, OUTPUT);
  pinMode(SDO_PIN, INPUT);
  lcd.begin (16, 2);
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();
}

void loop() {
  lcd.setCursor(0, 0);
  int chk = DHT.read11(DHT11_PIN);
  lcd.print("Temp: ");
  lcd.println(DHT.temperature,0);
  lcd.setCursor(0, 1);
  lcd.print("Humidity: ");
  lcd.println(DHT.humidity,0);
  delay(2000);
}


texts: I am doing a project on a ATtiny85 which involves using 433MHz RF modules. Whenever I want to compile any sketch using the Manchester library I always get these errors : "Manchester library doesnt support your microcontroller". Could anyone help me solving this?


texts: Arduino not connecting, but running the code I wrote last

texts:
My Arduino was working fine one day except it wasn't getting enough power, so I grabbed a 12v power supply, and when I plugged it in nothing happened. So I checked the 2 things behind the port that say:
47
25v
VT

with a test light, and somehow the power jumped through it I guess and after that it won't connect but it's still running the last written code. Plz help.


texts: FSR wiring using internal pullup resistors?

texts:
What are the disadvantages to using Arduino's internal pullups with a force force sensitive resistor (FSR) sensor?

All the wiring examples I see for FSRs place the sensor on the high side and use a 10k pulldown resistor. Searching Google, I can find virtually no one who places the FSR on the low side and uses the internal pullup. Since this would reduce complexity by using one less wire and resistor, I have to assume there's some big downside I'm not seeing. Why shouldn't you use the internal pullup?

I've worked with conventional potentiometers in the 100k ohm range, and I've found that with values that high, the Arduino's ADC finds a lot of noise, resulting in a sensor value that jitters and drifts. I found that the only reliable way to get a stable ADC value is to use a potentiometer with a maximum value of 10k or less. Since the FSR's range is up to 1M ohms, I'm worried I won't be able to get a stable reading. Does wiring it via the high side or low side effect this? What can I do to minimize noise from the FSR, other than shielding the sensor cable or adding a capacitor between the signal a and ground wire?


texts:
So I have 2 Arduinos, and im wanting to remove the chip from one and reset it to like it came from the factory and then breadboard it and attempt to program it using an AVR programmer (Or maybe an Arduino AS a programmer).

Why? Mainly because I want to make sure I can and understand how to program the chips when I order them standalone and on a breadboard.

Is this possible? I imagine the Arduino bootloader will be on the chip and the fuses will be different, but can I over-write them if I decide to just program it as a standalone AVR chip?

Thanks!


texts: ToF VL53L1X sensor integrate with arduino

texts:
I have this latest version VL53L1X time of flight laser distance sensor: http://www.st.com/en/imaging-and-photonics-solutions/vl53l1x.html

I study about this sensor, It says that sensor only Access with API(Application program Interface) how do I Integrate that API code in arduino or
how do I use Wire library to Integrate this sensor.


texts: How to make a stepper motor move at sinusoidal acceleration?

texts: I am new to arduino but I know basic concepts. How do I make the motor move at sinusoidal acceleration? I used the accelstepper library and it seems that at the end of each loop of distance with acceleration, the motor abruptly stops and begins accelerating again. Is there any way to stop this abrupt pause?


texts:
This code is used to toggle an arduino on and off , the problem is that i can't comprehend it at all. can someone explain to me how does it work ?

New = digitalRead(button);
  if ( New!=old)
  {
    if ( New == HIGH ){
      if (LEDstatus == LOW)
    {  digitalWrite(LED,HIGH);
    LEDstatus = HIGH;
    }
    else
    {
      digitalWrite(LED,LOW);
      LEDstatus=LOW;
    }
    }
    old=New;
  }


texts: Bootloader fails when two Arduinos are connected over serial port

texts:
I’d like to connect two Arduinos over serial port so that they can communicate with each other. Initially, I put all necessary code onto one device and now connected another via serial port. As soon as I connected the second one I lost the ability to upload new code onto the first one. I’m certain they are conflicting over serial pins. I tried to hold reset on the second Arduino, but it didn’t help. The only way to flash it back again with avrdude is to disconnect the second one.

Is there a way to get this setup working with serial bootloader without disconnecting pins? Thanks for your ideas.

I do not use the Arduino IDE. I believe that if someone has a solution for Arduino it will work for me. I use Atmel Studio 7 with avr gcc. The boards are Chinese clones with ATMega328P on them flashed with the optiboot bootloader. Pins connected are TxD and RxD to opposites on the second board. They are powered from the same power supply. This question is not how to communicate with another Arduino. This question is how to still be able to flash one Arduino while something else is connected to its serial port. I know that the USB to serial bridge IC is connected, but this is a standard setup on all Arduinos that have no embedded USB controller.

Board is Arduino Nano v3 clone with CH340 USB<->UART chip. Both boards work OK by themselves, once connected together they stop responding to avrdude. The connection is as following. Length of connection is only 15cm.

Nano v3 (1)        |          Nano v3 (2)
    |              |              |
RX0 o-----+------~ ~ ~------+-----o TX1
    |     |        |        |     |
TX1 o---+-|------~ ~ ~------|-+---o RX0
    |   | |        |        | |   |
      --o-o--      |      --o-o--
       CH340       |       CH340
         ^         |         ^
         |         |         |
        USB        |        USB


texts: Arduino Mega 2560 with SIM808 module - Incomplete SMS response

texts:
I have this code to read a SMS:

String read_SMS(int index)
{
  Serial.println("--START READ SMS POSITION" + String(index) + "--");
  delay(400);
  sendATcommand("AT+CMGF=1", "OK", 1000);    // sets the SMS mode to text
  delay(2000);
  String tmp;
  tmp = readATcommand("AT+CMGR=1", 4000);
  Serial.println("Content: " + tmp);
  Serial.println("--END READ SMS POSITION" + String(index) + "--");
}

String readATcommand(String ATcommand, unsigned int timeout)
{
  char response[800];
  unsigned long previous;
  memset(response, '\0', 800);    // Initialice the string

  int x = 0;

  GSMSerial.println(ATcommand);
  delay(3000);
  previous = millis();
  do {
    if (GSMSerial.available() > 0) {
      response[x] = GSMSerial.read();
      x++;
    }
  } while ((millis() - previous) < timeout);   // Waits for the asnwer with time out

  return (String) response;
}

// sending AT commands to the Sim808 module
int8_t sendATcommand(String ATcommand, char* expected_answer, unsigned int timeout) {

  uint8_t x = 0, answer = 0;
  char response[200];
  unsigned long previous;

  memset(response, '\0', 200);    // Initialice the string

  delay(100);

  // Clean the input buffer
  while (GSMSerial.available() > 0 ) GSMSerial.read();

  if (ATcommand[0] != '\0') {
    // Send the AT command
    GSMSerial.println(ATcommand);
    //Serial.print(F("AT Command: "));
    //Serial.println(ATcommand);
  }

  // Waiting for the answer
  x = 0;
  previous = millis();

  do {

    // if there are data in the UART input buffer, reads it and checks for the asnwer
    if (GSMSerial.available() > 0) {

      response[x] = GSMSerial.read();
      x++;
      // check if the desired answer (OK) is in the response of the module
      if (strstr(response, expected_answer) != NULL) {
        answer = 1;
      }
    }

  } while ((answer == 0) && ((millis() - previous) < timeout));   // Waits for the asnwer with time out

  //Serial.println(F("START RESPONSE:"));
  //Serial.println(response);
  //Serial.println(F("END RESPONSE"));
  //if (answer == 0) {
  //  Serial.println("Could not get the expected answer!");
  //}
  //else {
  //  Serial.println("Found expected answer!");
  //}

  return answer;
}

What can be wrong in the readATcommand function as it replies with an incomplete response:

--START READ SMS POSITION1--
Content:
AT+CMGR=1

+CMGR: "REC READ","+407245402XX","","17/06/29,10:
--END READ SMS POSITION1--

But, when I run it from a terminal, the AT+CMGR=1 replies with:

AT+CMGR=1

+CMGR: "REC READ","+40724540234","","17/06/29,10:03:06+12"
Salut

OK

As you can see the message body is not there + the time of the SMS is also incomplete.

Thank you!


texts: Can I change VCC pin to 3.3V on a 5V Arduino Pro Micro?

texts:
I'm using a 5V Arduino Pro Micro (schematic).

For my project, I'm using the VCC pin to output power to an external device.  I need VCC to output 3.3V to the external device.  Can I open jumper SJ1 to reduce the voltage of the VCC pin without affecting the operation of the other parts of the unit?


texts: ESP8266 + DHT11 AWS IOT Thing not updating thing shadow - was working before

texts:
I was able to get this working - https://www.youtube.com/watch?v=8hpro1olRK0 - send an SMS and email of temperature and humidity data from AWS IOT using esp8266 + dht11 but all of a sudden it stopped updating the shadow.

Here is the code

#include <ESP8266WiFi.h>
#include <DHT11.h>
#include <AmazonIOTClient.h>
#include <ESP8266AWSImplementations.h>

Esp8266HttpClient httpClient;
Esp8266DateTimeProvider dateTimeProvider;

AmazonIOTClient iotClient;
ActionError actionError;

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

// Pin 2 will be used to read sensor data
int pin = 2;

// Initializing the sensor
DHT11 dht11(pin);

//Function to convert Celsius to Fahrenheit
double Fahrenheit(double celsius) {
  return ((celsius * 9 / 5) + 32);
}

void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.println();

  // Connecting to Wi-Fi
  WiFi.mode(WIFI_STA);
  Serial.println();
  Serial.println();
  Serial.println("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

  iotClient.setAWSRegion("us-west-2");
  iotClient.setAWSEndpoint("amazonaws.com");
  iotClient.setAWSDomain("al1x5kb4rzh0x.iot.us-west-2.amazonaws.com");
  iotClient.setAWSPath("$aws/things/esp8266/shadow/update/accepted");
  iotClient.setAWSKeyID("AKIAJJQ6ASLIDIPBE4PQ");
  iotClient.setAWSSecretKey("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");
  iotClient.setHttpClient(&httpClient);
  iotClient.setDateTimeProvider(&dateTimeProvider);
}

void loop() {
  int err;
  float temp, humi;

//Reading the sensor data
  if ((err = dht11.read(humi, temp)) == 0) {
    Serial.print(" temperature:");
    Serial.print(temp);
    Serial.print(" humidity:");
    Serial.print(humi);
    Serial.println();
  } else {
    Serial.println();
    Serial.print(" Error No :");
    Serial.print(err);
    Serial.println();

  }
// Converting the float data to char arrays
  char sTemp[10], sHumi[10];
  dtostrf(humi, 6, 2, sHumi);
  dtostrf(temp, 6, 2, sTemp);

// Creating the thing shadow to be sent to aws iot
  char shadow[100];
  strcpy(shadow, "{\"state\":{\"reported\": {\"Humidity\":");
  strcat(shadow, sHumi);
  strcat(shadow, ", \"Temperature\":");
  strcat(shadow, sTemp);
  strcat(shadow, "}}}");
  Serial.print(shadow);

  char* result = iotClient.update_shadow(shadow, actionError);
  Serial.print(result);

  delay(60000);
}

Output as expected

Connecting to
NETGEAR53
.........
WiFi connected
 temperature:31.00 humidity:32.00
{"state":{"reported": {"Humidity": 32.00, "Temperature": 31.00}}}al1x5kb4rzh0x.iot.us-west-2.amazonaws.com
443
POST $aws/things/esp8266/shadow/update/accepted HTTP/1.1
Content-Type: application/json
Connection: close
Content-Length: 65
Host: al1x5kb4rzh0x.iot.us-west-2.amazonaws.com
x-amz-content-sha256: 923ed1ae613a9e14b45e4d080b092daf5cf61118041dc5225956299d5b0f8d49
x-amz-date: 20180323T034259Z
Authorization: AWS4-HMAC-SHA256 Credential=AKIAJJQ6ASLIDIPBE4PQ/20180323/us-west-2/iotdata/aws4_request,SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date,Signature=a10f0969043e609743412478567c10290b8c000185f2824e4a9cf07bb96cf279

{"state":{"reported": {"Humidity": 32.00, "Temperature": 31.00}}}


texts: Detect if Serial1 and Serial2 are defined, at compile time

texts:
I have my library that uses Serial, Serial1 and Serial2 to establish various logging scenarios. Library user would define the config at class constructor, using simple byte constants like 0, 1 and 2.

Problem is, Serial1 and Serial2 are not available in all board types. So when I compile my code (that compiles fine on Mega) on Uno, I get error
'Serial1' was not declared in this scope.

So I figure I need to adjust my code with preprocessor directive like #if defined, in order to include some code only if Serial1 is defined. But it wouldn't work, because Serial1 is defined later, at compile-time. So what is the accepted way to do this?


texts: Getting "avrdude:stk500_recv(): programmer is not responding" while uploading sketch to Arduino Pro Mini

texts:
I recently bought an Arduino Pro Mini(3.3V 328p, 8MHz) along with a CP2102 USB to TTL UART convertor. When I try to upload a sketch to the Pro Mini using it, I get a avrdude:stk500_recv(): programmer is not responding error. My connection was like

Arduino pro mini                CP2102
TXO  ----------------------------> TXD
RXI  ----------------------------> RXD
VCC  ----------------------------> 3V3
GND  ----------------------------> GND
DTR  ----------------------------> DTR

I tried inter-connecting the TXO and RXI pins and had no luck. Also pressing and releasing the reset button on the Pro Mini doesn't seem to work either.  I also tried programming it with my Arduino Uno, by removing the 328 and connecting correspondingly. Still no use.

Does any one have any ideas?


texts: LinkNode D1 Serial stops working when using pinMode

texts:
The following code works. I get an output in the console every second of "Hello" and then the analogValue of the photoresistor.

int greenLedPin = D1;
int yellowLedPin = D2;
int redLedPin = D3;

int lightSensorPin = A0;
int analogValue = 0;

void setup() {
  Serial.begin(9600);
//  pinMode(greenLedPin, OUTPUT);
//  pinMode(yellowLedPin, OUTPUT);
//  pinMode(redLedPin, OUTPUT);
}

void loop() {
  analogValue = analogRead(lightSensorPin);
  Serial.println("Hello.");
  Serial.println(analogValue);
  delay(1000);
//  digitalWrite(greenLedPin, HIGH);
//  digitalWrite(yellowLedPin, HIGH);
//  digitalWrite(redLedPin, HIGH);
}

Now as soon as I uncomment the pinMode commands nothing shows up on the console.

int greenLedPin = D1;
int yellowLedPin = D2;
int redLedPin = D3;

int lightSensorPin = A0;
int analogValue = 0;

void setup() {
  Serial.begin(9600);
  pinMode(greenLedPin, OUTPUT);
  pinMode(yellowLedPin, OUTPUT);
  pinMode(redLedPin, OUTPUT);
}

void loop() {
  analogValue = analogRead(lightSensorPin);
  Serial.println("Hello.");
  Serial.println(analogValue);
  delay(1000);
//  digitalWrite(greenLedPin, HIGH);
//  digitalWrite(yellowLedPin, HIGH);
//  digitalWrite(redLedPin, HIGH);
}

Any idea what might be going on?


texts: How is it possible that my skin temperature is so constant?

texts:
Here's the code

#include <OneWire.h>

int DS18S20_Pin = 3; //DS18S20 Signal pin on digital 3
unsigned long startTime = 0;
#define MEASURE_PERIOD 250
//Temperature chip i/o
OneWire ds(DS18S20_Pin);  // on digital pin 3

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

void loop() {
  if((millis() - startTime) >= MEASURE_PERIOD)
    {
        startTime += MEASURE_PERIOD;
        float temperature = getTemp();
        Serial.println(temperature);
    } //just here to slow down the output so it is easier to read

}

float getTemp(){
  //returns the temperature from one DS18S20 in DEG Celsius

  byte data[12];
  byte addr[8];

  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1000;
  }

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

  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      Serial.print("Device is not recognized");
      return -1000;
  }

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

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

  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }

  ds.reset_search();

  //byte MSB = data[1];
 // byte LSB = data[0];

  float tempRead = ((((int)data[1]) << 8) | data[0]); //using two's compliment
  float TemperatureSum = tempRead / 16;

  return TemperatureSum;

}


texts:
I want to program Attiny88 with Arduino IDE 1.6.5. I chose Attiny88  because it's the cheapest Attiny (as low as $0.5) and at the same time has 28 pins. I found a library that support Attiny88 (https://github.com/TCWORLD/ATTinyCore) but it seams it does not support IDE 1.6.5 and generates errors when I burn bootloader or during ISP.

Is there any library to program Attiny88 with Arduino 1.6.5?


texts: Atmel microcontrollers are not cheap compared to STM and Microchip. Why did Arduino select Atmel MCUs such as atmega328 and atmega2560 on their board out of so many alternatives?


texts: how can i generate square pulse at 50khz frequency to drive two mosfets at a duty ratio .6

texts: I have to switch 2 MOSFET IRF640 at a duty ratio of .6 and the frequency of  switching is  50khz how can I generate it with a single aurdino


texts:
I have written a code that remaps the buttons of TTP229 touch keypad which works as it is. Is there any way to optimize this code:

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

#define SCL_PIN 11
#define SDO_PIN 12
#define I2C_ADDR    0x3F
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

byte Key;
String keyRemap[12][2] = {
    {"1","1"},{"2","2"},
    {"3","3"},{"5","4"},
    {"6","5"},{"7","6"},
    {"9","7"},{"10","8"},
    {"11","9"},{"14","0"},
    {"13","Clear"},{"15","Enter"}
};

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
    lcd.begin (16,2);
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);
    lcd.home ();

    pinMode(SCL_PIN, OUTPUT);
    pinMode(SDO_PIN, INPUT);
}
void loop()
{
    Key = Read_Keypad();
    if (Key != 0) {
        lcd.clear();
        lcd.setCursor (0,0);
        for (int x = 0; x < 12; x++) {
            if (Key == keyRemap[x][0].toInt()) {
                lcd.print(keyRemap[x][1]);
            }
        }
        delay(160);
    }
}
byte Read_Keypad(void)
{
    byte Count;
    byte Key_State = 0;

    for (Count = 1; Count <= 16; Count++)
    {
        digitalWrite(SCL_PIN, LOW);
        if (!digitalRead(SDO_PIN))
            Key_State = Count;
        digitalWrite(SCL_PIN, HIGH);
    }
    return Key_State;
}


texts: 8X8 LED not lightning up according to matrix assignment on a Arduino Nano

texts:
I'm currently trying to code a simple program that would allow me to light up an individual LED on an 8X8 LED board using a double array.

Here are the problems:

All the rows can ON individually UNTIL I turn all 8 rows ON. When I do this the last column turns OFF by itself (see attached pictures).

The columns aren't even working properly either. Every time I assign a column ON, the last column faintly turns ON too (one of the LEDs light in that column is broken so that is expect to be OFF. See picture).

I think those are the reasons why I am not able to singly assign a particular LED to be ON according to assignments in the array. If someone could spot my mistakes, it would greatly be appreciated. Thanks!

int led2 = 2;
int led3 = 3;
int led4 = 4;
int led5 = 5;
int led6 = 6;
int led7 = 7;
int led8 = 8;
int led9 = 9;
int led10 = 10;
int led11 = 11;
int led12 = 12;
int led13 = 13;
int led16 = 16;
int led17 = 17;
int led18 = 18;
int led19 = 19;

int rowPins [8] ={led19, led18, led11, led7, led12, led5, led4, led16};//assigning each LED to a row.
int columnPins [8] ={led13, led17, led9, led10, led2, led8, led3, led6};//assigning each LED to a column

int image [8][8]=
{

{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},

};

void setup()
{
  for (int i = 0; i<8; i++)
  {
      pinMode(rowPins[i], OUTPUT);
      pinMode(columnPins[i], OUTPUT);
  }
}//end of setup()

void loop ()
{
for (int y=0; y<8; y++)
{
 for (int x=0; x<8; x++)
 {
   if (image[x][y]==1)
   {
     digitalWrite (columnPins[x], HIGH);
   }
   else
   {
     digitalWrite(columnPins[x], LOW);
   }
 }//end of 2nd for loop

  digitalWrite(rowPins[y], LOW);
  delayMicroseconds(100);
  digitalWrite(rowPins[y], HIGH);
}//end of first for loop
}//end of loop


texts: Buffer overflow error in ESP8266_SoftwareSerial library

texts:
I am running into buffer issues when running the Firmware.ino example here.

The output from my Arduino serial log on baudrate 115200 (I put the ESP on baudrate 9600):

Begin
01:17:15.538 -> Baudrate set success
01:17:15.585 -> Station + softAP - OK
01:17:18.631 -> Joining AP successful, IP: 192.168 r⸮+@⸮
01:17:18.991 -> Single Mode OK
01:17:18.991 -> Sending Request to www.google.com
01:17:19.084 -> create tcp - OK
01:17:19.710 -> not sentbuffer is full!
01:17:20.022 -> HZiw93GUFmVJYFz-yRmahGURP_UBbRb4EF0Ahwzx8MJ1GOyC5Z0dns8UD41G8kUqnL0oxNPxa6xF9nAqNF3X3B_hKW11zoyaBPn8trvUNt-69qbFCNOZwNjgoaloKbOQs7NN-B3tpmwFKpHfKsfKyZfiMdhulN3SgZMhewYBg9c; expires=Wed, 05-Feb-2020 05:17:18 GMT; path=/; domain=.google.com; HttpOnly
01:17:20.162 -> Accept-Ranges: none
01:17:20.162 -> Vary: Accept-Encoding
01:17:20.209 -> ConnecS,
01:17:24.179 -> Sending Request to www.google.com
01:17:24.774 -> create tcp - ERROR
01:17:28.759 -> Sending Request to www.google.com
01:17:29.432 -> create tcp - ERROR
01:17:33.402 -> Sending Request to www.google.com
01:17:34.021 -> create tcp - ERROR
01:17:38.028 -> Sending Request to www.google.com
01:17:38.669 -> create tcp - ERROR
01:17:42.681 -> Sending Request to www.google.com
01:17:43.294 -> create tcp - ERROR
01:17:47.298 -> Sending Request to www.google.com
01:17:47.954 -> create tcp - ERROR
01:17:51.925 -> Sending Request to www.google.com
01:17:52.595 -> create tcp - ERROR
01:17:56.563 -> Sending Request to www.google.com
01:17:57.204 -> create tcp - ERROR
01:18:01.222 -> Sending Request to www.google.com
01:18:01.871 -> create tcp - ERROR
01:18:05.839 -> Sending Request to www.google.com
01:18:06.460 -> create tcp - ERROR
01:18:10.456 -> Sending Request to www.google.com
01:18:10.596 -> create tcp - OK
01:18:11.049 -> buffer is full!
01:18:11.049 ->
01:18:11.049 ->
01:18:11.049 -> +IPD,1430:HTTP/1.1 200 OK
01:18:11.096 -> Date: Tue, 06 Aug 2019 05:18:09 GMT
01:18:11.096 -> Expires: -1
01:18:11.096 -> Cache-Control: private, max-age=0
01:18:11.143 -> Content-Type: text/ht
l; charset=ISO-8859-1
01:18:11.143 -> P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
01:18:11.190 -> Server: gws
01:18:11.190 -> X-XSS-Protection: 0
01:18:11.190 -> X-Frame-Options: SAMEORIGIN
01:18:11.224 -> Set-CooS,
01:18:15.192 -> Sending Request to www.google.com
01:18:15.822 -> create tcp - ERROR
01:18:19.849 -> Sending Request to www.google.com
01:18:20.473 -> create tcp - ERROR

As you can see, at first it starts ok, gives a buffer error, runs in error for a while, then runs OK again. This happens a couple times, then it runs only in error. I imagine this is some issue with the buffer of the ESP or the Arduino, but I'm not sure how to diagnose it further.

Things I have tried to fix the error:
 - As mentioned in the Firmware.ino example comments, I uncommented #define ESP8266_USE_SOFTWARE_SERIAL
 - Also as mentioned in the comment, I changed line 42 from 64 to 256. It didn't work either time.
 - There is a MAX_BUFFER_SIZE in the included ESP8266.h library that I also changed, from 300 to 256, because I thought that might help, but the error persisted.


texts: Going from one shift register to two shift registers

texts:
I am able to control one shift register with this shift function:

void shift (int pin) {
  shiftOut(ds,shcp,MSBFIRST,pin);
  digitalWrite(stcp,HIGH);
  delay(100);
  digitalWrite(stcp,LOW);
}

but when I move to 2 shift registers it does not add up.. how do I need to adapt this method to make it work with 2 shift registers when I am going from 8 leds to 16 leds?

My second register now just copies the first register.. I want the second register to continue instead of repeat


texts: Component with controllable resistance from Arduino?

texts:
I'm new to Arduino and building circuits, and was wondering if there is a type of component, or some other way to do the following task:

I want to control the resistance of a circuit from my computer linked to my Arduino, presumably using an output analog PIN.

Basically what I have is an LED whose brightness I want to control from my computer. I want to be able to control the resistance of the circuit to limit the electricity going to the LED, and I want to be able to do this from my computer (not physically, with a potentiometer) (unless a potentiometer's resistance can also be controlled from a PIN?).

How can I do this?


texts:
I'm trying to incorporate audio into my Arduino project for the first time, and have been have a lot of issues. I originally couldn't get the Audio library to work, but after installing it through the Arduino application, I figured the Audio.h library would work fine. However, it spit out this error:

  WARNING: library Audio claims to run on (sam) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).
  In file included from /Documents/Arduino/libraries/Audio/src/Audio.h:16:0,
                   from /Documents/Arduino/boxgame/boxgame.ino:1:

Then it lists plenty of syntax issues, none of which have to do with my code. I think it's giving errors from the library, but I'm not really sure what's happening. Here's an example of one of the slew of errors:

  /Users/tschadius/Documents/Arduino/libraries/Audio/src/DAC.h:37:2: error: 'IRQn_Type' does not name a type
    IRQn_Type isrId;

Any ideas as to how I can fix this? The error message goes on for quite a while, but none of them appear to be from my code that I've written.

Thanks!


texts:
I have a pretty simple project, where some data has to be read from a mySQL server. My idea is to do this with an ESP8266, and then provide that data to the Arduino Mega.

Is this possible or am I going to have to use the ESP8266 itself? I highly doubt that I would have enough pins then.

I read something about AT-commands. But I have no idea how to send those commands to the ESP.

Thanks in advance,

Michidez


texts:
When I call the tone function on a Uno, why do I not have to declare the pinmode in setup? Like so:

// Simplest tone
void setup() {
}

void loop() {
    tone (8,500); //on pin 8 output 500 Hz
}


texts:
After installing the Arduino IDE on MacOS (1.8.5), I am trying to run some commands in the terminal to flash the firmware on an Uno R3.

I have successfully connected and uploaded through the GUI, but would like to use the command line for the johnny-five API (https://github.com/rwaldron/johnny-five/wiki/Getting-Started).

However, when running

arduino --install-library "Firmata,Servo"

I get the following error:

  -bash: command not found

How do I install the command line interface?


texts: Problems stopping an if loop, and starting it as well

texts:
I want my code to run my motor for a specific amount of time at a specific speed and then stop and not do anything else. I'm having trouble here, I think with my switch and the if loops running on repeat. What is a good way for me to stop the code from looping? And any helpful hints on my switches will be appreciated as well? Thanks and I hope you had a wonderful thanksgiving if you're American. If you're not, I hope you just had a great day in general.

#include <Servo.h>
#include <Adafruit_MotorShield.h>
#include <Wire.h>

Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *DC1 = AFMS.getMotor(1);
Adafruit_DCMotor *DC2 = AFMS.getMotor(2);
Adafruit_DCMotor *DC3 = AFMS.getMotor(3);
Adafruit_DCMotor *DC4 = AFMS.getMotor(4);

Servo Servo1;

void setup() {
  digitalWrite(A0, HIGH); //Turns on the pullup resistor for A0
  AFMS.begin(); //Initializes the motorshield board
  int motorPin1 = 1;
  int motorPin2 = 2;
  int motorPin3 = 3;
  int motorPin4 = 4;
  pinMode(A0, INPUT); //Sets the Analog Pin 0 as an input
  digitalWrite(A0, HIGH);
  pinMode(A1, INPUT);
  digitalWrite(A1, HIGH);
  pinMode(A1, INPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  Servo1.attach(9);
}

void loop()  {
  int MAXampDrawTime = 1000;
  int MAXampDrawSpeed = 20;
  int NORMampDrawTime = 1500;
  int NORMampDrawSpeed = 10;
  int DrawTime = MAXampDrawTime + NORMampDrawTime;
  int ServoTime = 450;
  int previousMillis = 0;
  int inPin0 = LOW;
  int inPin1 = LOW;
  inPin0 = digitalRead(A0);
  inPin1 = digitalRead(A1);
  unsigned long time_zero = millis();
  unsigned long current_time = millis();

  if (inPin0 == HIGH) {
    time_zero = millis();
    current_time = millis();
    while (millis() - time_zero < MAXampDrawTime); {
      dcMoveConst(MAXampDrawSpeed, 1);
      dcMoveConst(MAXampDrawSpeed, 2);
      dcMoveConst(MAXampDrawSpeed, 3);
      dcMoveConst(MAXampDrawSpeed, 4);
    }
    while (millis() - time_zero < NORMampDrawTime); {
      dcMoveConst(NORMampDrawSpeed, 1);
      dcMoveConst(NORMampDrawSpeed, 2);
      dcMoveConst(NORMampDrawSpeed, 3);
      dcMoveConst(NORMampDrawSpeed, 4);
    }
    if (millis() - time_zero > DrawTime) {
      dcMoveConst(0, 1);
      dcMoveConst(0, 2);
      dcMoveConst(0, 3);
      dcMoveConst(0, 4);
    }

    if (millis() - time_zero >= ServoTime); {
      Servo1.write(0);
      delay(400);
      Servo1.write(90);
    }
  }

  if (inPin1 == HIGH) {
    time_zero = millis();
    current_time = millis();
    MAXampDrawTime = 1000;
    MAXampDrawSpeed = 20;
    NORMampDrawTime = 1500;
    NORMampDrawSpeed = 10;
    DrawTime = MAXampDrawTime + NORMampDrawTime;
    while (millis() - time_zero < MAXampDrawTime); {
      dcMoveConst(MAXampDrawSpeed, 1);
      dcMoveConst(MAXampDrawSpeed, 2);
      dcMoveConst(MAXampDrawSpeed, 3);
      dcMoveConst(MAXampDrawSpeed, 4);
    }
    while (millis() - time_zero < NORMampDrawTime); {
      dcMoveConst(NORMampDrawSpeed, 1);
      dcMoveConst(NORMampDrawSpeed, 2);
      dcMoveConst(NORMampDrawSpeed, 3);
      dcMoveConst(NORMampDrawSpeed, 4);
    }
    if (millis() - time_zero > DrawTime) {
      dcMoveConst(0, 1);
      dcMoveConst(0, 2);
      dcMoveConst(0, 3);
      dcMoveConst(0, 4);
    }

    if (millis() - time_zero >= ServoTime); {
      Servo1.write(0);
      delay(400);
      Servo1.write(90);
    }
  }
}


texts:
#include <Wire.h>
  #include <LiquidCrystal_I2C.h>
  #include "digitalWriteFast.h"

  #define BUTTONPIN 2
  #define FDCSPIN 6
  #define CIPIN 5
  #define SPEAKERPIN 4

  float RPM=1000.0;
  int PWus=1.5*1000.0;
  int FDCSoffset=(1000.0/RPM/60.0/4.0) - (PWus/1000.0);
  int totalCnt;
  int CIState=B00000000;
  bool Buttonstate=0;
  LiquidCrystal_I2C lcd(0x27, 20, 4);

  void setup()
  {
    Serial.begin(9600);
    lcd.begin();
    lcd.backlight();
    lcd.clear();
    lcd.print("READY TO TEST"); // Waiting for button press
    pinMode(BUTTONPIN, INPUT);// Setting button as Input
    pinMode(FDCSPIN, OUTPUT); // Fuel Delivery Control Signal
    pinMode(CIPIN, OUTPUT); // Cylinder Identification
    digitalWriteFast(FDCSPIN, LOW);
    digitalWriteFast(CIPIN, LOW);
  }

  void loop()
  {
   Buttonstate=digitalReadFast(BUTTONPIN);
   if(Buttonstate==1)
   {
    delay(5);
    if(Buttonstate==1)
    {
      runInjectorTest();
    }
   }
  }
  void runInjectorTest()
  {
    lcd.print("Test Run");
    playtesttone();

      for(totalCnt=0;totalCnt<8000;totalCnt++)
      {

        PORTD=CIState;
        delayMicroseconds(PWus);
        PORTD=PORTD^B01000000;
        delayMicroseconds(FDCSoffset);
        if(totalCnt%4==0)
        {
          CIState=CIState^B00100000;
        }
      }
    totalCnt=0;
    playfinishtone();
  }
  void playtesttone()
  {
    tone(SPEAKERPIN, 500, 500);
    delay(700);
    tone(SPEAKERPIN, 500, 500);
    delay(700);
    tone(SPEAKERPIN, 500, 500);
    delay(700);
    tone(SPEAKERPIN, 2000, 500);
  }
  void playfinishtone()
  {

    tone(SPEAKERPIN, 2000, 500);
    delay(700);
    tone(SPEAKERPIN, 2000, 500);
    delay(700);
    tone(SPEAKERPIN, 2000, 500);
    delay(700);
    tone(SPEAKERPIN, 500, 500);

  }

I am trying to generate 2 signals using the code above and this output is
From the image, the lime green signal is called FDCS and the other is called CI. Note that the scope shows the inverted form of the signal. I want the falling edge of CI to match with the Falling edge of the 5th FDCS signal (right now rising edge is matching with the falling edge of the CI signal). But the Rising edge of the CI signal should match with the Rising edge of the first FDCS signal (which it's already doing). How do I change my code to do this?


texts:
int r = 12;
int g = 11;
int b = 10;
int sw = 4;
int x;
int c = 0;

void setup() {
    pinMode(r, OUTPUT);
    pinMode(g, OUTPUT);
    pinMode(b, OUTPUT);
    pinMode(sw, INPUT);
    pinMode(13, OUTPUT);
}

void loop() {
    x = digitalRead(sw);
  if(x==HIGH) {
    delay(250);
    c++;
    if(c==1) {
        digitalWrite(r, HIGH);
        digitalWrite(g, LOW);
        digitalWrite(b, LOW);
       {
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
      }

    }
    else if(c==2) {
        digitalWrite(r, LOW);
        digitalWrite(g, HIGH);
        digitalWrite(b, LOW);
             {
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
      }
    }
        else if(c==3) {
        digitalWrite(r, LOW);
        digitalWrite(g, LOW);
        digitalWrite(b, HIGH);
             {
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
      }
    }
        else if(c==4) {
        digitalWrite(r, HIGH);
        digitalWrite(g, HIGH);
        digitalWrite(b, LOW);
             {
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
      }
    }
            else if(c==5) {
        digitalWrite(r, LOW);
        digitalWrite(g, HIGH);
        digitalWrite(b, HIGH);
             {
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
      }

    }
            else if(c==6) {
        digitalWrite(r, HIGH);
        digitalWrite(g, LOW);
        digitalWrite(b, HIGH);
             {
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        digitalWrite(13,HIGH);
        delay (250);
        digitalWrite(13, LOW);
        delay (250);
        c=0;
      }

    }

  }
}


texts:
I am new to working with Arduino and I have a basic question.

I have an entire circuit set up and functioning, but I would like to add an arcade style button (Larger concave style) like this.

So my question is, how would I go about wiring this button to the Arduino? I don't need this button to control any lights or any other functions. The basic function of this button is for my code to register if the button is pressed or not. I also have the code done. I just want to know how to wire this.

Also I don't know if this helps, but I already have two normal tactile buttons (with 4 pins) in the circuit connected with a pull-up resistor and I know how to connect them. I just have no idea how to go about with only 2 pins.

Any help would be greatly appreciated. Thanks.


texts: Using attachInterrupt() to make a reset button for my code?

texts:
I have used attachInterrupt() to reset my program to the beginning. It actually interrupts while running the 3 states as shown below inside of the if statement but when I press the actual button it does not exit, it goes to the function and continuing to the next state. It only works (means exiting/resetting) after all three states have executed completely.

if(buttoncount<2){
  originalstate();
  alertstate();
  evacuationstate();

I would like to make a button to stop the program while running in the middle and start again.

Code:

// Declaring pins

// Input pins
const int sensor1button_pin = 6;
const int sensor2button_pin = 3;
const int sensor3button_pin = 4;
const int sensor4button_pin = 5;
const int sensor5button_pin = 2;
const int sensor6button_pin = 15;
const int sensor7button_pin = 15;

// Output pins
const int led1_pin = 8;
const int led2_pin = 9;
const int led3_pin = 10;
const int led4_pin = 11;
const int buzzerpin = 15;

// Initialy buzzer at false mode
boolean flag1;
boolean flag2;
int flag3 ;

// for leds
int ledState1 = LOW;   // Original
int ledState2 = LOW;   // Alert
int ledState3 = LOW;   // Evacuate
int ledState4 = LOW;   // Isolate

// Buttons
int button1_state = LOW;
int button2_state = LOW;
int button3_state = LOW;
int button4_state = LOW;
int button6_state = LOW;
int button7_state = LOW;
int button5_state = LOW;

// Other variables
int buttoncount = 0;
int reset_switch=0;

void setup() {
  // INPUT pins
  pinMode(sensor1button_pin, INPUT);
  pinMode(sensor2button_pin, INPUT);
  pinMode(sensor3button_pin, INPUT);
  pinMode(sensor4button_pin, INPUT);

  pinMode(sensor5button_pin, INPUT_PULLUP);

  attachInterrupt(digitalPinToInterrupt(sensor5button_pin), clearreset, CHANGE);

  pinMode(sensor6button_pin, INPUT);
  pinMode(sensor7button_pin, INPUT);

  // OUTPUT pins
  pinMode(buzzerpin, OUTPUT);
  pinMode(led1_pin, OUTPUT);
  pinMode(led2_pin, OUTPUT);
  pinMode(led3_pin, OUTPUT);
  pinMode(led4_pin, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  button1_state = digitalRead (sensor1button_pin);
  button2_state = digitalRead (sensor2button_pin);
  button3_state = digitalRead (sensor3button_pin);
  button4_state = digitalRead (sensor4button_pin);
  button5_state = digitalRead (sensor5button_pin);
  button6_state = digitalRead (sensor6button_pin);
  button7_state = digitalRead (sensor7button_pin);

  Serial.println(digitalRead (sensor5button_pin));

  if( button1_state == HIGH || button2_state == HIGH || button3_state == HIGH || button4_state == HIGH) {
    delay(280);
    buttoncount = buttoncount + 1;
  }

  if (button1_state == HIGH || button2_state == HIGH || button3_state == HIGH || button4_state == HIGH) {
    if(buttoncount<2){
      originalstate();
      alertstate();
      evacuationstate();
    }
  }
}

// LED lighting arrangements
void originalstate() {
  digitalWrite(led1_pin, HIGH);
  digitalWrite(led2_pin, LOW);
  digitalWrite(led3_pin, LOW);
  digitalWrite(led4_pin, LOW);
  delay(1500);
}

void alertstate() {
  digitalWrite(led1_pin, LOW);
  digitalWrite(led2_pin, HIGH);
  digitalWrite(led3_pin, LOW);
  digitalWrite(led4_pin, LOW);
  delay(1500);
}

void evacuationstate() {
  digitalWrite(led1_pin, LOW);
  digitalWrite(led2_pin, LOW);
  digitalWrite(led3_pin, HIGH);
  digitalWrite(led4_pin, LOW);
  delay(1500);
}

void isolatestate() {
  digitalWrite(led1_pin, LOW);
  digitalWrite(led2_pin, LOW);
  digitalWrite(led3_pin, LOW);
  digitalWrite(led4_pin, HIGH);
}

// Clear or reset back to the begin

void clearreset() {
 button1_state = LOW;
 button2_state = LOW;
 button3_state = LOW;
 button4_state = LOW;
 button5_state = LOW;
 button6_state = LOW;
 button7_state = LOW;

 digitalWrite(led1_pin, LOW);
 digitalWrite(led2_pin, LOW);
 digitalWrite(led3_pin, LOW);

 buttoncount = 0;
 exit;
}


texts: Adafruit Feather M0 Basic Proto doesn't show up

texts:
I bought a Feather M0 basic from Amazon here. I installed all the board definitions and stuff from here I restarted the IDE and when I plugged it in, the Feather doesn't show up in ports or device manager. I am using a data cable that I verified. Debug is off and USB stack is Arduino.

I also tried following the instructions here but it didn't work.

When I double-clicked the reset button, the red LED didn't pulse.

Is there anything that am I missing?

Edit: Feather is supplying 3~ volts. USB is supplying 4.5~ volts.

Edit 2: Charing LED lights up when li-poly is plugged in.


texts: How to connect Firebase cloud messaging with NodeMCU using httpClient SSL

texts:
I use nodeMCU to connect to FCM API to send a push notification to a mobile application. I tested out in postman everything works fine and send a push notification to mobile but the problem when I use httpclient in Arduino it gives -1 error if I did https const char* cloudMessagingServer = "https://fcm.googleapis.com/fcm/send"; when I use http only without SSL const char* cloudMessagingServer = "http://fcm.googleapis.com/fcm/send"; gives a 403 error code
My code
  const char* cloudMessagingServer = "fcm.googleapis.com/fcm/send";

  char json[] = "{\"to\":\"<my_mobile_token>\",\"notification\":{\"title\":\"Hello\",\"body\":\"Yellow\"}}";

  HTTPClient http;
  http.begin(cloudMessagingServer);
  http.addHeader("Authorization", "key=<my_key>");
  http.addHeader("Content-Type", "application/json");
  int httpResponseCode = http.POST(json);

  if (httpResponseCode>0) {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
  }
  else {
    Serial.print("Error code: ");
    Serial.println(httpResponseCode);
  }
  // Free resources
  http.end();

After some search I found that should add fingerprint of host to create a SSL request
My code after adding fingerprint
  const char* cloudMessagingServer = "fcm.googleapis.com/fcm/send";

  char json[] = "{\"to\":\"<my_mobile_token>\",\"notification\":{\"title\":\"Hello\",\"body\":\"Yellow\"}}";
  const char* fingerprint =            "a9 07 09 14 98 12 22 b8 58 3f db 6e 93 36 f7 3f 13 e2 72 82";

  HTTPClient http;
  http.begin(cloudMessagingServer, fingerprint);
  http.addHeader("Authorization", "key=<my_key>");
  http.addHeader("Content-Type", "application/json");
  int httpResponseCode = http.POST(json);

  if (httpResponseCode>0) {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
  }
  else {
    Serial.print("Error code: ");
    Serial.println(httpResponseCode);
  }
  // Free resources
  http.end();

when I use https in all cases give me -1


texts: Arduino receives no external UART comms after Serial.begin(9600)

texts: I face the following issue. I connected my RasPi (3b) with an Arduino Uno via RX/TX and a logic level converter. UART comms from the RasPi to the Arduino and vice-versa work fine on minicom and serial monitor. It also works fine from my qt program to the serial monitor, but as soon as I start a Serial.begin(9600,8N1) or Serial.begin(9600) function on the Arduino there seems to be no communication anymore at all between the two. Neither the expected result (toggle an LED, works from serial monitor), nor any blinking of the tx/ex LEDs onboard anymore. Issue occurs no matter if I provide power to the Arduino via USB or the 9v powercable. Any suggestions?


texts: So if my arduino will draw around 800mA @5V and the dc-dc buck converter around 266mA @5V plus solenoid 1.2A @12V, is it a good idea to get 12V 4A (48W) power supply? Since Filip Franik told me that it is a good practice to get 2 times the current I need just in case. Then what will happen to the current that are no in use?


texts: How do I use interrupt service routines inside libraries and classes?

texts:
I'm trying to have a millis() timer run to emulate a hardware timer inside a library, but I'm having issues compiling the code. I want the callback (pseudo ISR) to be part of the class, and not use global variables.

I'm using Christensen's / Monk's Timer library, but I'm open to suggestions if there are other better/easier timer libraries out there.

This is what I have so far. It's just an example for me to understand how this might work. I'm sure there are better ways of making an LED blink, but this is just for illustrative purposes.

Compiling gives a bunch of "invalid use of member variables in static functions" errors.

  error: invalid use of member 'Blink::_led_status' in static member function
           int _led_status;

EDIT

After trying to add glue routines as per your other answer I can seem to get one instance working, but adding another stops the first light from blinking, and the second one blinks on and off at the wrong times.

The test library is on github

Blink.h

#ifndef Blink_h
#define Blink_h

#include "Arduino.h"
#include <Timer.h> // https://github.com/JChristensen/Timer/master
    // Timer.h uses millis() instead of built in timers

class Blink {
public:
  Blink (int led_pin, int duration);
  void begin ();
  void updateTimer();

private:
  static void _callbackGlue();
  void _callback();

  static Blink *_instance;
  Timer *_blink_timer;
  int _led_pin;
  int _duration;
  int _led_status;
  int _blink_event;
};
#endif

blink.cpp

#include "Arduino.h"
#include "Blink.h"

Blink *Blink::_instance;

Blink::Blink (int led_pin, int duration) {
  _blink_timer = new Timer();
  _led_status = 0;
  _led_pin = led_pin;
  _duration = duration;
  pinMode(_led_pin, OUTPUT);
  digitalWrite(_led_pin, LOW);
}

void Blink::begin () {
  _blink_event = _blink_timer->every(_duration, _callbackGlue);
  _instance = this;
}

void Blink::_callbackGlue() {
  _instance->_callback();
}

void Blink::_callback() {
  if (_led_status == 0) {
    digitalWrite(_led_pin, HIGH);
    _led_status = 1;
  } else if (_led_status == 1) {
    digitalWrite(_led_pin, LOW);
    _led_status = 0;
  }
}

void Blink::updateTimer() {
  _blink_timer->update();
}

test/test.ino

#include "Blink.h"

Blink first_blink (13, 500);
//Blink second_blink (12, 1000);

void setup() {
  Serial.begin(9600);
  Serial.println("Starting...");
  first_blink.begin();
  //second_blink.begin();
}

void loop() {
  first_blink.updateTimer();
  //second_blink.updateTimer();
}


texts:
Trying to create an elf file for two sets of files in different folders.

LIDARBOT.h
-----------
#ifndef LIDARBOT_H_
#define LIDARBOT_H_

#include <avr/io.h>
#include "drivers/motors.h"

#endif

LIDARBOT.C
----------
#include "LIDARBOT.h"
int main(){
  pwmtimersetup();
    while (1) {
    }
}

motors.h
--------
#ifndef MOTORS_H_
#define MOTORS_H_

#include <avr/io.h>

void pwmtimersetup(void);

#endif

motors.c
--------
#include <avr/io.h>
#include "motors.h"

void pwmtimersetup(void){
  // Timer pre-scalar for ~490 Hz is 8
  TCCR0B &= ~((1<<CS02)||(1<<CS00));
  TCCR0B |=  (1<<CS01);
  // Set Compare Output Mode to Toggle PWM
  TCCR0A &= ~(1<<COM0A1);
  TCCR0A |=  (1<<COM0A0);
  // Waveform Generation Mode: WGM02 = 1, WGM01 = 1, WGM00 = 1
  TCCR0B |= (1<<WGM02);
  TCCR0A |= (1<<WGM01)||(1<<WGM00);
  OCR0A = 125;
  DDRD |= (1<<DDD4)||(1<<DDD2);
  PORTD |= (1<<PORTD4);
  PORTD &= (1<<PORTD2);
}

I can make a consolidated object file but not an elf file to load onto my board. Output below:

avr-gcc -g -Os -Wall -Werror -Wextra  -mmcu=atmega328p -DF_CPU=1000000UL -Wa,-ahlmns=LIDARBOT.lst -o objects/LIDARBOT.o \
source/LIDARBOT.c \
source/drivers/motors.c \
-I/home/manu/C/Arduino/LIDARBOT/libraries/

avr-gcc -g -Os -Wall -Werror -Wextra -mmcu=atmega328p -DF_CPU=1000000UL -o elf/LIDARBOT.elf objects/LIDARBOT.o
objects/LIDARBOT.o: In function `__vector_22':
(.text+0x7c): multiple definition of `__bad_interrupt'
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o:(.text+0x0): first defined here
objects/LIDARBOT.o: In function `__vectors':
(.text+0x0): multiple definition of `__vectors'
/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5/crtatmega328p.o:(.vectors+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:191: elf] Error 1

I am kind of lost. What could be my mistake here? If I see an error like this how do i start to debug?


texts: Could you tell me what is wrong with this Arduino code?

texts:
void fn( int pin, int pos)
{
    Servo temp;
    temp.attach(pin);
    temp.write(pos);
    delay(15);
    temp.detach();
}

void loop()
{
    int pos = 0 ;
    for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
        // in steps of 1 degree
        //tmp2.write(pos);
        //delay(15);
        fn(41,pos);
        fn(2,180 - pos);
    }
    for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
        fn(41,pos);
        fn(2,180 - pos);
    }
}

But when I run the code in mega , the servo does not move when attached to pin 2 or 41.
The reason I am creating a function fn , is so that the servo does not stay attached. I want the servo to rotate freely when I am not giving it a pwm signal.


texts:
I have a project which uses a 128x64 oled display. I have to use the U8GLIB as the available displays change from SSD1306 to SSH1106 depending on when you buy it which that library covers both displays.
I don't want the program for the display to eat up the memory of the arduino so I use u8glib instead of u8g2! for this project I need to display numbers 0 to 9, decimal point, omega (ohm symbol) and metric prefixes such as μ,m,k,M, etc...
I first tried to create a bitmap font (.bdf) and convert it to a C file because that was what was hinted at on a few posts. There were no tutorials and after messing about with the different formats and trying to add the font to the library I just gave up because I couldn't figure it out. Instead I decided to use this website which generates bitmaps from TTF files:
https://littlevgl.com/ttf-font-to-c-array
Now I can use those bitmaps and have my few characters which use very little memory (about 20% as opposed to more than 70% using a complete symbols font in u8g2!) but this makes things really awkward as I have to translate every number I get into separate digits and then into a bitmap! also I can only use font sizes which have a height in multiples of 8 because for some weird reason this library expects width in number of bytes and height in number of pixels!

cnt: Number of bytes of the bitmap in horizontal direction. The width
of the bitmap is cnt*8.

so I can do fonts of size 48 for example, but not 50 or 52 which would be more suitable for my application!
I'm not sure if anyone else has had this issue but there must be a way to display the characters you want without destroying your entire memory space like u8g2 does! Just getting to this point took me 2 days (on the left there is a 0.96" SSD1306 and on the right there is a 1.3" SSH1106):

Please help if you have any idea on how to deal with this library as it's driving me insane at the moment!


texts:
I was looking at this link on RFID I2C interface. I added the library to arduino, but in main.cpp, I see an error:

In function 'void setup()':
sketch_mar27a:16: error: no matching function for call to 'TwoWire::begin(int, int)'
Wire.begin(SDA_PIN, SCL_PIN); // Initialize I2C

I looked at Wire.cpp file and found that there is no such member function overloaded with two parameters.
How should I fix the problem? Even if I fix this one problem, I am not sure if this code is working code.
Where can I find working code with I2C interface? I have resource problem and SPI PORT cannot be used.
The code:
#include <Wire.h>

#include "MFRC522_I2C.h"

#define SDA_PIN 5
#define SCL_PIN 6
#define RST_PIN 3

MFRC522 mfrc522(0x28, RST_PIN);  // Create MFRC522 instance.

void ShowReaderDetails();

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  Wire.begin(SDA_PIN, SCL_PIN); // Initialize I2C
  mfrc522.PCD_Init();   // Init MFRC522
  ShowReaderDetails();  // Show details of PCD - MFRC522 Card Reader details
  Serial.println(F("Scan PICC to see UID, type, and data blocks..."));
}

void loop() {
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;
  }

  // Dump debug info about the card; PICC_HaltA() is automatically called
  mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

void ShowReaderDetails() {
  // Get the MFRC522 software version
  byte v = mfrc522.PCD_ReadRegister(mfrc522.VersionReg);
  Serial.print(F("MFRC522 Software Version: 0x"));
  Serial.print(v, HEX);
  if (v == 0x91)
    Serial.print(F(" = v1.0"));
  else if (v == 0x92)
    Serial.print(F(" = v2.0"));
  else
    Serial.print(F(" (unknown)"));
  Serial.println("");
  // When 0x00 or 0xFF is returned, communication probably failed
  if ((v == 0x00) || (v == 0xFF)) {
    Serial.println(F("WARNING: Communication failure, is the MFRC522 properly connected?"));
  }
}


texts: Are there different revisions of Arduino Uno SMD?

texts: I know there are different revisions of the Arduino Uno itself, but are there any revisions of the SMD? If they are is SMD R2 identical to through-hole R2? I have a board marked R2 SMD and I am wondering if that is the only version that they produced in SMD format and just are signifying that it is compatible with the standard R2.


texts: Pin change interrupt does not work properly to wake up arduino from sleep mode

texts:
I am building a timer circuit using Arduino Pro Mini Atmega168p 5v 16MHz (which later supposed to be become to adjustable one).

Here is the current breadboard view.

(I am supposed to use SS relay at place of that green thing. I am not sure if that item is correct SS relay in Fritzing)

Here is the program code I wrote.

#include <PinChangeInterrupt.h>
#include <PinChangeInterruptBoards.h>
#include <PinChangeInterruptPins.h>
#include <PinChangeInterruptSettings.h>

#include <avr/sleep.h>

// LED to indicate timer is active.
const int ON_LED = 5;
// It should be high when timer is active.
// Connect to relay.
const int PUMP_SWITCH = 6;

// Button to start timer running.
const int START_BUTTON = 8;
// Button to stop timer forcefully.
const int STOP_BUTTON = 9;

volatile boolean timer_running;
volatile int timer_start_time;

// TODO: Make it volatile once timer has mdified as configurable.
volatile unsigned long timer_time = 0;

void enter_sleep_mode() {
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sei();
  sleep_mode();
}

/**
 * Activate timer.
 */
void start_timer() {
  if (!timer_running) {
    // Time period in milliseconds.
    timer_time = 30000ul; // 30 seconds

    timer_running = true;
    timer_start_time = millis();
  }
}

/**
 * Stop timer.
 */
void stop_timer() {
  timer_running = false;
  timer_start_time = 0;
}

void setup() {
  timer_running = false;
  timer_start_time = 0;

  // Configure output pins.
  pinMode(ON_LED, OUTPUT);
  pinMode(PUMP_SWITCH, OUTPUT);

  // Configure pins for input push buttons.
  pinMode(START_BUTTON, INPUT_PULLUP);
  pinMode(STOP_BUTTON, INPUT_PULLUP);

  // Attach interrupt handlers
  // Buttons are with pull up resistors so listening for 'falling' (voltage).
  attachPCINT(digitalPinToPCINT(START_BUTTON), start_timer, FALLING);
  attachPCINT(digitalPinToPCINT(STOP_BUTTON), stop_timer, FALLING);
}

void loop() {
  if (timer_running) {
    digitalWrite(ON_LED, HIGH);
    digitalWrite(PUMP_SWITCH, HIGH);
    // TODO: Handle the case when return value of millis() goes back to start from zero
    if ( (millis() - timer_start_time) >= timer_time ) {
      // Timer elapsed the required time period.
      // So, stop the timer.
      stop_timer();
    }
  }
  else {
    digitalWrite(ON_LED, LOW);
    digitalWrite(PUMP_SWITCH, LOW);
    // Nothing to do If timer is not running.
    // Save power!!
    enter_sleep_mode();

    sleep_disable();
  }
}

The problem is timer does not work when pressing START button starting from third click. Two initial clicks works OK and timer functions as it should be. I think it does not wake up properly from sleep mode. However, wondering why it works for two initial clicks??

Please help me to identify the problem.
I don't have much experience in writing Arduino code.

Thanks


texts:
so I'm new to all this Arduino stuff and have been trying to get into it, starting off with a simple project/test but have been having some issues. I followed the set up the book provides, and am powering the Arduino through an usb cable with my Laptop. The Arduino turns on and works fine but the LED on the breadboard will not turn on. Its connected to the Arduino and I believe I connected it to the right port ,5V and GND right? Anyways, I will leave some pictures below so you guys can see what I'm talking about.

Here's the set up they have in the book

https://imgur.com/a/W1FphDW

Here's a pic of the Arduino

https://imgur.com/a/qWK0KZ6

And this is how my setup looks

https://imgur.com/a/gPuajE7

Zoom in
https://imgur.com/a/KPPiMQv


texts: Audio Amplifier won't work on Arduino Nano

texts:
I am using an Arduino Nano with these speakers and these audio amplifiers. I've tested these both on an Arduino Uno, and I've tested the Nano with other sketches and on that pin, and they both work. The input pin is pin 3, and the power is the 5v pin. Nothing happens when try it on the nano, but it works fine on the Uno.
This is how I wired it on my nano,
And this is how I wired it on my Uno,
But only the Uno works, and the nano doesn't. The wiring in the pictures is based on this diagram on the amazon page of the audio amp,


texts: Calculate power requirement for 64 rgb led ws2812b

texts:
Hi I am working on small project where I want to run ws2812b module via arduino and lipo battery. I have purchased 64 matrix for ws2812b from eBay and lipo battery with 500mah.

I am looking to find how I can calculate how much power does WS2818b modules will consume with all leds running and will the battery be sufficient for it. How long will it run on full charge.

Can someone please point me to the formula how I can calculate this. Also to note I am using a power up converter from 3.7 to 5v.


texts: How can big Arduino programs be analyzed easily?

texts:
I have an Arduino project code, but the problem is it has multiple functions and flow of control.

How could I convert this code into flowchart or control flow diagram?

Any software or online website?


texts: How do I connect through a HC-05 to PS4 Controller?

texts:
Searching for Arduino and PS4 on google, I find always the same construction using a USB host shield and a Bluetooth dongle.

But I'd like to connect a PS4 Controller to a HC-05 device. Is it possible? If not, why not?


texts: Can a DHT11+ESP8266 be powered by a Adafruit USB LiPo charger directly?

texts:
I have rigged up a small DHT11+ESP8266 combo which I'm currently powering from the 3.3v from an Ardruino. I've ordered a 3.7v LiPo battery and have a Adafruit usb micro LiPo charger, however, the battery will take two weeks to come.

Can I plug the usb charger directly into the DH11 while my battery arrives?


texts: Advice for lower power clock type project

texts:
Arduino newbie here! I'm a programmer but my hardware knowledge is ... slim.

I'd like to build a clock type wake up timer for my daughter, using an Arduino type board. Probably overkill, but it's practice for me, not just the end result! The idea is that is sleeps all night, then around say 4, gradually fade on a red LED. At 6, which is when she's allowed to come in, the red LED switches to a green, or some colourful sequence that tells her it's time. At a later time, maybe 7/8, it goes back to sleep to conserve power.

I have an Arduino Uno, but looks like I'll also need an RTC, and I've read that the sleep power consumption is ~40mA, which on batteries is what? A day or two max?

So I'm thinking I can't do this with a Uno.

So, my question is, are there any very low power Arduino compatible boards with built in RTCs that I can use for this project that will get me up and running as quickly as if I was using the Uno?


texts: Is there such a thing as an "Always" loop?

texts:
I seem to remember somewhere somebody making an "Always" loop between Setup() and Loop().

But I can't find any documentation on it. Does such a thing exist, or am I imagining it?