text:
Optical Rotary Encoder Index issue
I have the following code working correctly except for the Index portion.
I am not sure if I have the syntax correct for the hardware.  The end result I am looking for is to have the encoder reset to 0 degrees every time the index comes around (360 degrees).
I am also looking for any comments on the code as I would like the encoder output to be as accurate and efficient as possible.
Here is the code:
// Wiring connections for my encoder:
// Brown : VCC = 5V
// Blue + Shield : 0V = GND
// Black : ENCODER0PINA, Pin 20
// White : ENCODER0PINB, Pin 17
// Orange : ENCODER0PINI, Pin 19

#define ENCODER0PINA         20      // this pin needs to support interrupts
#define ENCODER0PINB         17      // no interrupt required
#define ENCODER0PINI         19      // this pin needs to support interrupts
#define CLOCKWISE            1       // direction constant
#define COUNTER_CLOCKWISE    2       // direction constant

// variables modified by interrupt handler must be declared as volatile
volatile long encoder0Position = 0;
volatile long interruptsReceived = 0;
volatile byte INTFLAG1 = 0;

// track last position so we know whether it's worth printing new output
long previousPosition = 0;

void setup()
{

  // inputs
  pinMode(ENCODER0PINA, INPUT_PULLUP);
  pinMode(ENCODER0PINB, INPUT_PULLUP);
  pinMode(ENCODER0PINI, INPUT_PULLUP);

  // interrupts
  attachInterrupt(3, onInterrupt, RISING);
  attachInterrupt(4, onReset, CHANGE);

  // enable diagnostic output
  Serial.begin (9600);
  Serial.println("Ready.");
}

void loop()
{
  // only display position info if has changed
  if (encoder0Position != previousPosition )
  {
    Serial.println(encoder0Position, DEC);

    previousPosition = encoder0Position;
  }
}

// interrupt function needs to do as little as possible
void onInterrupt()
{
  // read both directional inputs
  int a = digitalRead(ENCODER0PINA);
  int b = digitalRead(ENCODER0PINB);

  if (a == b )
  {
    // b is leading a (counter-clockwise)
    encoder0Position--;
    if (encoder0Position < 0)
    {
      encoder0Position = (encoder0Position + 360);
    }
  }
  else
  {
    // a is leading b (clockwise)
    encoder0Position++;
    if (encoder0Position >= 360)
    {
      encoder0Position = (encoder0Position - 360);
    }
  }

void onReset()
{
  // read Index input
  int i = digitalRead(ENCODER0PINI);

  if (i = 1)
  {
  encoder0Position = 0;
  }
}

except for the Index portion is not a good description of the observed behavior .... please clarify what that means

In your onReset() function you have an assignment instead of a comparison:
if (i = 1) // This is always true
{
encoder0Position = 0;
}

i = 1 should be i == 1

Craig, is that the proper syntax for an Optical Encoder, if (i == 1)?  I am not sure if that is the output of the interrupt?

if (i == 1) is correct.


text:
How to monitor state of 50 Digital Inputs
Good day.
I have a specific project need and I spent the past couple of days searching on forum, blogs, etc and I'm still not clear if that's feasible to do with Arduino or not.
I need to monitor the state of ~50 digital inputs and trigger an action when any of the pin changes either from 0 to 1 or from 1 to 0, pretty much the same as pin state interrupt works, only difference is that I need to "listen" to ~50 pins, instead of just a couple. I must be able to identify what pin triggered the action and what was the change (0->1 or 1->0).
My initial idea is to use a MEGA 2560 and have a group of 50 "if" statements on the main loop comparing the previous state or each pin (stored in individual variables) with the current one and triggering the corresponding action if something changed.
I'd like to hear from the experts here what would be a more elegant or smarter/faster way to accomplishing this.
I'm eager to receive your feedback.
Thank you.

50 ifs? define a constant array of pin number and a for loop over it. and define an array of states to remember the last state.

One alternative is to use daisy-chained parallel-in, serial-out shift registers such as 74HC165. Those parts can be bought for less than 30 cents each from ebay or aliexpress.

I/O expanders, for example the pcf8574 have an interrupt. You would only have to wait for an interrupt, and then request via i2c which pin has changed.

I had a project that used 16 rotary encoders and I used the MUX Shield which uses 74HC4067 analog multiplexers. They port to A0 - A3 on the shield which is fine as you can set these pins to Digital Inputs else you can get teh breakout version and connect to any input pins.
I also used a Due since ALL pins can be interrupt enabled.
Reading was a bit of a pain but worked like this...
The method is.. Continually address each input in turn in the loop or an interrupt is not detected, when an interrupt fires, address each input in turn again to find out which pin changed state.
Hope that helps.

The Mega 2560 appears to have 24 pin change interrupts (I haven't checked if they're all broken out on the Mega Arduino board).
A combination of as many pin change interrupts and 'manual' scanning could be quicker than scanning them all individually.
Another option would be to group as many as possible onto the same ports and use direct hardware access to looks for changes- with this you'd be able to do 8 inputs at a time. With 8 inputs on each port, you just need to have seven main checks that the port value has changed and then jump off to a handler that deals with what specific pin has changed and what action is needed.

See answers in Good solution for more interrupts on an Arduino. E.g.:
Answer lhballoti:
You can use an I/O expander, for example an MCP23008 and MCP23017. They are available in SPI and I2c. Interrupts can be configured (edge-sensitive, level-sensitive) for each input.
Answer embedded.kyle:
You could use a Programmable Interrupt Controller (PIC) such as the 82C59A. It will cascade if you need more than the eight interrupts it provides. It's a bit old school but I think it will handle all of your requirements.

source: Stack Exchange

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

sort: votes


text:
Bending pins of HC-SR04
I got a question regarding the ultrasound sensor (HC-SR04) connecting to the arduino. I have a project, and the space is really tight, so i will have to bend the pins of the HC-SR04. Is this okay to do, and if yes, how should i go about and do this ?

The easiest things to do if space is a premium is to unsolder (or cut) the pins and then solder directly the wire to the corresponding spots.
Otherwise, you can also just get straight pins and replace them, You can also choose on which side of the board, as the holes are though it.
Lastly, about bending, it's doable with pliers if you want to make the pins face "forward" but depending on the quality of your pins they might break in the operation.

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


text:
No data sent over serial port in linux c++
TL;DR - I am attempting serial communication with Arduino with code that I found here and nothing gets sent over (Arduino programmed to respond, and I checked that it does with its serial monitor)
Hi there,
I was looking for a way to send information over to an Arduino Mega (2560) unit over linux serial port by C++.
I came across the following solution: Solution
I'm using this guy's code for write (I'm able to read data from the arduino) and use the same parameters (they work, as I'm able to receive data from the Ardunio).
I programmed my Arduino to send "Hi" over serial whenever it sees at least 1 bit of information, and checked it worked through the Arduino IDE Serial Monitor.
Yet when running the C++ code, the arduino doesn't respond. Do anyone might have idea why?
Full disclosure - I inserted @Lunatic999's code to a class so I can make an instance of it for my needs of the code.
fd = open(portNameC, O_RDWR | O_NOCTTY | O_SYNC); //open port ("opens file")

Serial Parameters:
struct termios tty;
struct termios tty_old;
memset (&tty, 0, sizeof tty);

/* Error Handling */
if ( tcgetattr ( fd, &tty ) != 0 ) {
   std::cout << "Error " << errno << " from tcgetattr: " << strerror(errno) << std::endl;
}

/* Save old tty parameters */
tty_old = tty;

/* Set Baud Rate */
cfsetospeed (&tty, (speed_t)B9600);
cfsetispeed (&tty, (speed_t)B9600);

/* Setting other Port Stuff */
tty.c_cflag     &=  ~PARENB;            // Make 8n1
tty.c_cflag     &=  ~CSTOPB;
tty.c_cflag     &=  ~CSIZE;
tty.c_cflag     |=  CS8;

tty.c_cflag     &=  ~CRTSCTS;           // no flow control
tty.c_cc[VMIN]   =  1;                  // read doesn't block
tty.c_cc[VTIME]  =  5;                  // 0.5 seconds read timeout
tty.c_cflag     |=  CREAD | CLOCAL;     // turn on READ & ignore ctrl lines

/* Make raw */
cfmakeraw(&tty);

/* Flush Port, then applies attributes */
tcflush( fd, TCIFLUSH );
if ( tcsetattr ( fd, TCSANOW, &tty ) != 0) {
   std::cout << "Error " << errno << " from tcsetattr" << std::endl;
}

Write (this code I put inside a function which I call)
unsigned char cmd[] = "INIT \r";
int n_written = 0,
    spot = 0;

do {
    n_written = write( fd, &cmd[spot], 1 );
    spot += n_written;
} while (cmd[spot-1] != '\r' && n_written > 0);

Arduino code:
bool dataRecieved = false;
int ledpin = 13;

void setup() {
pinMode(ledpin, OUTPUT);
digitalWrite(ledpin, HIGH);
Serial.begin(19200);
}

void loop() {
  while(!dataRecieved)
  {
   digitalWrite(ledpin,HIGH);
   if (Serial.available() > 0)
   {
     dataRecieved = true;
   }
  }
  digitalWrite(ledpin,LOW);
  delay(1000);
  digitalWrite(ledpin,HIGH);
  delay(1000);
  Serial.println("hi");
}

@Juraj sorry, didn't post the correct version with the correct baudrate. now it is fixed. thanks!

remove the blinking and only turn the LED off

@Juraj nothing changed

then the problem is on linux side and off topic here

Well I am trying to connect with an arduino, so it might not be that off-topic (also good for future references for anyone that might need it as well). Anyhow, I'd still be happy to wait for more insights on this problem.

You are aware that the Arduino resets itself the moment you open the serial port and spends a second or so in the bootloader? During that time anything you send will be ignored completely.

@Majenko My savior! I was aware of the fact that when ever the serial opens, the arduino resets. I neglected the time it took the bootloader to finish (and the PC had no usleep command after the init of the serial interface). If you'll write this as an answer I'll be more than happy to accept it.

The Arduino resets the moment you open the serial port.  Once reset the bootloader executes, which consumes (and discards since it's invalid) any serial data for a second or so before your sketch runs.
Because of this anything you send immediately after opening the serial port is ignored.
There are two commonly accepted "fixes" for this:

Delay for a pre-defined period after opening the serial port, and
Have the Arduino send a "READY" signal before doing anything else which your program waits for before sending.


text:
How to create a weather station with only GY-BME280-3.3 chip and w5100 Ethernet shield mounted over arduino mega 2560 r3
Want to create a weather station with only GY-BME280-3.3 chip and w5100 Ethernet shield mounted over Arduino mega 2560 r3 but I have no previous experience with Arduino. And The Arduino will be hooked up to a router using the Ethernet shield and powered using desktop USB connection or may be with the barrel jack and I want to control it using a GNU/Linux machine. So far I am trying to follow these
https://educ8s.tv/arduino-bme280-weather-station,
https://startingelectronics.org/tutorials/arduino/modules/pressure-sensor,
http://cactus.io/projects/weather/arduino-weather-station,
but none of these is an exact match for my setup, so a little confusing as a noob. But my questions is,
How to hook up the GY-BME280-3.3 sensor to the Arduino on which the Ethernet shield is already mounted?
EDIT:
So far I have connected the first 4 pins to the pins on the Ethernet on 1->3.3v, 2->gnd, 3->A5, 4->A4  or  1->3.3v, 2->gnd, 3->13, 4->11, 5->10, 6->12 but to no avail. Only 1+6->3.3v, 2->gnd, 3->21, 4->20 finds the sensor but reading is 0,0,0mb in that case and shows reading if SparkFun BME280 library is loaded.
Still the question is, if there any other pin combinations where I don't have to join 1+6 to a 3.3v, just one pin to 3.3v will be enough?

Yes, it can, and it can be accomplished by writing software for it. What have you tried so far?

I'm voting to close this question as off-topic because this is not a general project suggestion and hand-holding site. Try https://forum.arduino.cc/index.php?board=3.0

@Majenko, So far I am trying to follow these https://educ8s.tv/arduino-bme280-weather-station/,
https://startingelectronics.org/tutorials/arduino/modules/pressure-sensor/,
http://cactus.io/projects/weather/arduino-weather-station, but none of these is an exact match for my setup, so a little confusing as a noob. The ethernet is working but it shows that the sensor is not connected.

how did you connect the sensor?

@Juraj I have updated the question :)

I added to answer: CSB must be connected to VCC to select I²C interface.

You must decide if you want to connect the sensor over I2C or over SPI interface. According to datasheet of the sensor, at power-up pin CSB determines the interface. If CSB is pulled-down SPI is selected. CSB must be connected to VCC to select I²C interface.
On current revisions of Mega and Uno the 'standard location' of I2C pins SDA and SCL is near pin 13 after the Ground and AREF pin. Other location on Mega are pins 20 and 21. (A4 and A5 on Uno). Note that the 'standard location' pis are connected together with the 'numbered' pins, so you can't use 20 and 21 even if you connect the sensor to the standard location pins.
Pin SDO determines the I2C address of the sensor.
If you want to use SPI to connect the sensor to Mega, use SPI pins 50 to 52 and you can use pin 53 as CS (SS) pin. Ethernet shield uses pin 10 as CS for W5100 and pin 4 as CS for pin for the SD card. Note, that Ethernet shield connects to SPI bus on the ICSP header, but those are still SPI bus pins 50 to 52.
Adafruit has a tutorial for this sensor with wiring for Mega.


text:
ESP8266 upload data to google cloud platform
I am trying to upload information to my appspot created with Google App Engine. I am able to do it when I in my browser type:
http://myname.appspot.com/query?city=Copenhagen&temp=20&id=website
But I cannot get it to work on the ESP8266. Here is my code:
const char* MY_URL = "http://myname.appspot.com";

void uploadHTTP() {
    // Define the WiFi Client
    WiFiClient client;
    // Set the http Port
    const int httpPort = 80;

    // Make sure we can connect
    if (!client.connect(MY_URL, httpPort)) {
        return;
    }
    else {
        Serial.println("Connected to MY_URL");
    }

    String url = "/query?city=Copenhagen&temp=20&id=ESP8266";

    // Post to appspot
    if (client.connect(MY_URL, httpPort)) {

        // Sent HTTP POST Request
        client.println("POST " + url + " HTTP/1.1");
        Serial.println("POST " + url + " HTTP/1.1");
        client.println("Host: " + String(MY_URL));
        Serial.println("Host: " + String(MY_URL));
        client.println("User-Agent: Arduino/1.0");
        Serial.println("User-Agent: Arduino/1.0");
        client.print("Content-Length: ");
        Serial.print("Content-Length: ");
        client.println(0);
        Serial.println(0);
        client.println("Content-Type: application/x-www-form-urlencoded");
        Serial.println("Content-Type: application/x-www-form-urlencoded");
        client.println("Connection: close");
        Serial.println("Connection: close");
        }
    //Done
    Serial.println("");
    Serial.println("my HTTP done");
    Serial.println("");
}

Are you programming the ESP8266 directly, or using it connected to an Arduino?

Your biggest problem is that you are trying to use a website URL as a FQDN. That's not going to work.
When you connect to a remote machine you connect to the name (myname.appspot.com) which gets translated into an IP address for you to open a connection to.
When you use a web browser it parses the URL to extract the protocol (http) and the FQDN (myname.appspot.com) and uses the protocol to determine the port (and what language to speak) to connect to, then look up the IP address from the FQDN.
You need to drop the http:// from your FQDN which is causing it to break (there is no host called http://myname.appspot.com).  The fact that you are connecting to port 80 and speaking the HTTP language implies that you are using HTTP.
To put it into more layman's terms: if you "need to call Fred to talk about going to the pub" you first look up fred's number in the phone book then call that number. Then only once he has answered do you talk about going to the pub. What you don't do is try and find the number to call by looking in the phone book under "talk about going to the pub with Fred". It won't be there.
If you are programming your ESP8266 directly you should consider using the much simpler bundled ESP8266HTTPClient.h library.

Thank you for the quick answer and the explanation - I did not know that! However I tried to change it to "myname.appspot.com" but it did not work?
I have also been trying to get it to work with ESP8266HTTPClient.h library but I could not get that to work either...

Is my 'Content-type' correct? Here is my code for the ESP8266HTTPClient.h:
['code']
(HTTPClient http;)
http.begin("myname.appspot.com");
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
int httpCode = http.POST("/query?city=Copenhagen&temp=20&id=ESP8266"); Sorry for the bad layout - I am new to this forum and cant get the comment to work....

You have no content, so content type is meaningless. You should really be doing a GET request not a POST request if there is no content to POST.

I have a content? I am setting the 'city' to 'Copenhagen', 'temp' to '20' and 'id' to 'ESP8266'

No, that's not content. Content goes in the body. You have URL parameters. URL parameters go on the end of the URL. You have no body, and zero content length, and your parameters are on the end of the URL. That is not "content".

Thank you! I now changed to GET and it is working


text:
How to use? ATmega328P Development Board for Arduino UNO R3 Bootloader Project DIY

How to use? ATmega328P Development Board for Arduino UNO R3 Bootloader Project DIY.

The answer is: you don't use it. Buy a cheap arduino uno clone. This development board does not have a usb-serial chip, therefor it is not possible to upload a sketch to it without extra hardware. It was probably in the description where you bought it, that you need an extra usb-serial module. Instead of buying an extra usb-serial module, you may just as well buy a arduino uno clone.

Looks like about 1/5th of an Uno with a ZIF socket. The rest, other than the ZIF socket, is pretty pointless. The USB is for power only. To program it you need an external USB UART interface. It doesn't even have a USB-ASP built in like you'd expect from something that looks like that.  Pretty much a pointless heap of junk.

@Majenko, the 2x3 header is labeled ICSP, so it is a bootloader flasher

No, that is for plugging a programmer into. like the Uno's icsp header.

The purpose of this board is to flash (Arduino) bootloader to Atmega 328 chips. It has not a build in programmer, only a ICSP header to connect the programmer.
So wire it with a programmer and then chip in, ZIF close, burn bootloader, ZIF release, chip out, next chip in, ZIF close, ....
video

Actually you can program with this device. Treat it as a Genuino Uno and select AVRISPmkII programmer. Used mine several times.


text:
Read Multiple Sensors Data from a text file located in SD Card in Arduino/ESP32
I am working on a small home project 'glucose meter' via non invasive techniques. I am using four sensors like RGB color sensor, two multi-wavelength photo diodes (A & B) and temperature sensor (K-Type Thermocouple). I am using Multi Regression algorithm to estimate Glucose level in human body by calculate all four readings from sensors.

I am using ESP32 and I am saving all my sensors data in a CSV file (or text) after taking more than 20 calibration data from my family and friends. I can read this file after writing but I am facing a problem in reading all calibration data from this text/CSV file in the following particular manner.
Y,Sensor1,Sensor2,Sensor3,Sensor4
92,103,25,65,9875
91,104,26,62,9805
105,92,30,66,9600
150,60,40,75,9233
...,...,...,.....

Above pattern indicates 'Y' values (Blood Sugar value mg/dl) and corresponding sensors value on that time.
I am facing problem in reading these object like:
Y1 = 92, S1 = 103, S2 = 25, S3 = 65, S4 = 9875
Y2 = 91, S1 = 104, S2 = 26, S3 = 62, S4 = 9805
....................AND so forth..............
Y1000 = XX, S1 = XX, S2 = XX, S3 = XX, S4 = XX

Can any one help me how would I read and categorize each sensor values from the text/CSV File?
Thanks.

Let's say you want to read this line from the file.
92,103,25,65,9875

code is
String one_line_data = file.readStringUntill("\n");
int y,s1, s2, s3, s4;
sscanf(one_line_data.c_str(), "%d,%d,%d,%d,%d", &y, &s1, &s2, &s3, &s4);

this way to read the one line of data from file you can expand to multiple line based on application.

Function file.parseInt(), will skip non numeric characters and then parse the number stopping on non numering character. So you need only call file.parseInt() for every value in row, process the data and then loop to next row.
Y1 = file.parseInt();
S1 = file.parseInt();
S2 = file.parseInt();
S3 = file.parseInt();
S4 = file.parseInt();


text:
FastLED fill_rainbow - Unexpected red pixel
I'm using FastLEDs builtin fill_rainbow function for generating a rainbow spectrum on an LED strip. The issue is, I get a random red pixel midway through the yellow region. I've tried it on 3 different Arduino nano's, and two different LED-strips. Here's the code:
#include <FastLED.h>

#define DATA_PIN 2
#define NUM_LEDS 114
CRGB leds[NUM_LEDS];

uint8_t hue = 0;

void setup() {
  Serial.begin(115200);
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

  fill_rainbow( leds, NUM_LEDS, hue, 1);
  for(int i=0; i<NUM_LEDS; i++) {
    Serial.print(i);
    Serial.print(' ');
    Serial.print(leds[i].r);
    Serial.print(' ');
    Serial.print(leds[i].g);
    Serial.print(' ');
    Serial.println(leds[i].b);
  }

  CHSV hsv;
  CRGB rgb;
  //rgb = hsv;
}

void loop() {
  fill_rainbow( leds, NUM_LEDS, hue, 1);
  FastLED.show();
}

Here pixel number 60 gets the rgb code 160, 0, 0. When it should have something like 160, 150, 0.
The strangest part of all is that I can get rid of the problem in two ways, either by uncommenting the line rgb = hsv;, or by commenting out the fill_rainbow function in the loop function. This strange behavior leads me to believe im somehow messing up a pointer or misusing a FastLED feature. Additionally the fill_rainbow function is very simple and relies on FastLEDs hsv to rgb typecasting, which is another reason to believe I'm doing something wrong.
So help me out here, am i doing something silly, or have I discovered a bug with FastLEDs hsv to rgb converter?

Issues with a specific third-party library are best raised with the author of the library. Raise an issue here.

@Majenko Sure, but the reason for posting the question is i suspect i made a mistake, as explained in the latter part of the question. I'm hoping to get some feedback on weather I have made a mistake before posting an issue at the developer.

I just copied your exact code and ran it with 600 of my LEDs. I have WS2812B as well, and using the same data pin coincidentally.
I haven't experienced your red LED issue. I then ran it again on my LEDs after adding
 hue++;

at line 33.
Only problem I can see is that the last 30 LEDs at the end of the rainbow kind of flicker. Groups of 10 LEDs spontaneously flicker at once, then another 10, and so on. This could be a problem with my LEDs though because they were the cheapest one's I could find on ebay 2 years ago. The code seems to work fine for me though!

It seems that this is caused by a compiler bug when compiling with the default -Os (optimize for size) option.
see Issue : fill_rainbow() - Unexpected red pixel #668
A workaround is to change the optimization level to -O3 for fill_rainbow, ie :
#pragma GCC push_options       // Disable the size optimization
#pragma GCC optimize ("-O3")   // to prevent the “red pixel” problem
void fill_rainbow( struct CRGB * pFirstLED, int numToFill,
                  uint8_t initialhue,
                  uint8_t deltahue )
{
    CHSV hsv;
    hsv.hue = initialhue;
    hsv.val = 255;
    hsv.sat = 240;
    for( int i = 0; i < numToFill; i++) {
        pFirstLED[i] = hsv;
        hsv.hue += deltahue;
    }
}
#pragma GCC pop_options // Enable the prior optimization

You would have to edit colorutils.cpp (the file where fill_rainbow lives above) in the FastLED source in your \libraries directory.


text:
ESP8266-01S Stopped responding after second launch
Here's the code:
#include <SoftwareSerial.h>
#define RX 6
#define TX 5

String AP = "...";
String PASS = "...";

SoftwareSerial esp8266(RX,TX);

void setup() {
  Serial.begin(9600);
  Serial.println("Setup started");

  esp8266.begin(115200); // Change this to the factory baudrate used by ESP8266
  delay(1000);

  Serial.println("Setting BAUDRATE to 9600");
  esp8266.println("AT+IPR=9600");
  esp8266.begin(9600);
  delay(500);
  Serial.println("Setup finished");

  reset();
  connectWifi();
}

//reset the esp8266 module
void reset() {
  Serial.println("Resetting...");
  esp8266.println("AT+RST");
  delay(3000);

  if (esp8266.find("OK"))
    Serial.println("Module Reset");
  else
    Serial.println("Module Reset Failed!!!");
}

//connect to your wifi network
void connectWifi() {
  Serial.println("Connecting to Wifi...");
  String cmd = String("AT+CWJAP=\"") + AP + "\",\"" + PASS + "\"";
  esp8266.println(cmd);
  delay(4000);
  Serial.println("Checking Wifi...");
  int ctr=0;
  while(!(esp8266.find("OK"))) {
    if(esp8266.find("ERROR")) {
      Serial.println("Cannot connect to wifi...");
      break;
    }
    delay(50);
    ++ctr;
    if(ctr>10){
      Serial.println("Cannot connect to wifi...");
      break;
    }
  }
  Serial.println("ConnectWifi finished");
}

The ESP8266-01S wires are as follows:

GND to arduino ground
3v3 to arduino 3v3
RX to arduino pin 5
TX to arduino pin 6
EN to arduino 3v3

The thing worked for one time, and when I re-compiled and sent it again without any changes or even button presses, it stopped working. Furthermore, if I connect ESP module directly through arduino rx and tx and connect arduino reset to ground, I still don't get anything. The led on the esp is blinking during data transfers, but everything else doesn't change and I get no response at all.

You need to re-flash your AI Thinker firmware. AT+IPR kills certain versions of the firmware.
Install the latest version of the firmware and use AT+UART_DEF=9600,8,1,0,0 and AT+UART=9600,8,1,0,0. (The former sets the default baud rate, the latter the current baud rate).
You can read more here.

After resetting everything works through direct connection to PC, but when using a SoftwareSerial I get:
Setting BAUDRATE to 9600
Response Received:
Q⸮⸮E}⸮ʂb⸮b⸮,F⸮⸮⸮P%U⸮IT=N⸮⸮⸮L0
Qi⸮C!⸮CC⸮
============
Command Sent: AT
Response Received:
⸮⸮⸮⸮

Here's my setup:
void setup() {
Serial.begin(9600);
ESP8266.begin(115200);
delay(1000);
Serial.println("Setting BAUDRATE to 9600");
ESP8266.println("AT+UART_DEF=9600,8,1,0,0");
ESP8266.println("AT+UART=9600,8,1,0,0");
ESP8266.begin(9600);
}
`

Welcome to the wonderful world of dodgy at firmware. I would suggest you program the esp8266 to perform the task you require of it and not rely on the awful at firmware.


text:
What are the benefits or advantages of Arduino CLI?
I saw that Arduino got a CLI (Command Line Interface), and my first question was "why?"  Even after reading the article, I don't see or understand its advantages.
What advantages or benefits does a CLI have for Arduino?
I haven't done much with Arduino in several years.  For example, there wasn't an Arduino SE when I was fooling around with Arduino, so I probably have an out of date context for Arduino development.

If you have to ask what the benefits are then the benefits most likely do not apply to or interest you.

it's for tooling and automation. i've used it to automatically recompile and deploy a sketch after another app updates a "hard-coded" table of IP addresses in the source, based on the results of a network scan.

Simple: you can program the Arduino without needing a GUI.
One good example: You have an Arduino connected to a Raspberry Pi built into a robot. You SSH into the Pi, edit the Arduino's program, and upload the new code. All from wherever you happen to be.
A second example: You can integrate Arduino compilation into your own software. Such as a web interface for compiling your code.  I know of one such project where the creator has made a custom website for editing their robot code and using UECIDE's CLI (which pre-dates Arduino's) to compile and upload the code to the target board.
And yes, you have an outdated context of Arduino development, as evidenced by your use of the phrase "fooling around with". Arduino is not a toy. It's a development platform and educational tool. Maybe back when you were "fooling around" with it, it was little more than a toy, but things have moved on a long long way since then. The Arduino ecosystem boasts boards with chips from every manufacturer you can imagine to fill every niche you can conceive. The API and available libraries have certainly matured.

One huge advantage that probably falls under "You can integrate Arduino compilation into your own software" is continuous integration. For example, you might configure Travis CI to compile your Arduino project every time you push a commit to GitHub. You can already do this using the Arduino IDE's CLI, but that means downloading and extracting many megabytes of GUI application that will never be used for every CI job (and there may be multiple jobs per build). That slows down the build and wastes Arduino and Travis CI's bandwidth. The arduino-cli download is only 5 MB.


text:
How to use the 0.91' 128*32 OLED by arduino pro mini?
I buy a OLED as picture below, I want to use https://github.com/adafruit/Adafruit_SSD1306 to control it. But the example of https://github.com/adafruit/Adafruit_SSD1306 can't be compiled. The error as the second picture below. How should I to use this OLED ?

It looks like there is more to the error message that isn't shown in your image. Instead of posting an image of text, copy and paste the error text into your question.

@josecanuc  I have add it. Could you help me ? Thanks.

In addition to installing the Adafruit_SSD1306 library, you also need to install the Adafruit_GFX library, which is a dependency of the SSD1306 library.


text:
LCD Identification FPC-JG00467-01B SR36
I salvaged an old LCD from a calculator (Texas Instruments) and I want to interface it with a microcontroller (preferably an Arduino). I‘ve searched the whole internet but I simply can‘t find any information about this display and its driver. I am looking for a specialist who can identify this:

It's most likely a custom part for which there is no public data sheet. LCDs are almost always custom-designed, and require special driver circuitry. This is especially true for such mass-produced items as calculators.
Edit:
There is code to screen capture using an ESP32.
https://github.com/marcrobm/TTRX_Remote/blob/master/main/drivers/TTRX_T30X.cpp
The Protocol is a relatively simple parallel interface with some data pins and a clock pin. To implement a Driver, one could implement the above linked code "in reverse".


text:
ESP8266 Software serial to ATmega 328 is not properly working
Thanks in advance..
We are having esp8266-12E chip and Atmega328 connected as follows,
ESP 12 pin as Tx,13 pin as Rx && Atmega328 13pin as Rx, 12pin as Tx. Everything works fine, but while communicating via serial some low pulse is being generated. We couldn't find the issue with multimeter anyway but got it by oscilloscope signal.
When this false low pulse during communication happens Atmega328 connected pins also getting low for the same duration.
We tried using separated logic execution for ESP and Atmega and both were worked perfectly, but only during communicating via Software serial its flickers getting started.
Please help us getting this resolved.

esp8266 SoftwareSerial doesn't work reliably

@Juraj: Thanks. Can I use default Tx and Rx? are those reliable?

yes of course. esp8266 has second hw Serial interface, but only TX of it can be used

That means I can transmit data to Atmega328 but could not get it back.

low pulse is being generated where is it being generated?

@jsotola, I read that esp8266 SoftwareSerial doesn't work reliably , but I never tested it. perhaps this 'low pulse' is an indices why it doesn't work. but I don't have time to investigate it

i did not ask a clear question .... the question is which pin generates the low pulse?

@jsotola, I wasn't clear too. connect an Uno to esp8266 over SoftwareSerial and you will know.

@jsotola, I did not say it will not work. It will work perfectly, but is not reliable

Don't use SoftwareSerial in esp8266. Connect the 328p's SoftwareSerial pins to Serial interface pins of the esp8266. ESP8266 has second Serial interface named Serial1. It has only TX (io 2), but it is enough for debug prints.
To change the firmware or sketch in esp8266 you can use ArduinoOTA library, but you should be ready to disconnect the esp8266 Serial pins from the 328p and use them for Serial upload if the OTA upload fails.
You should use logic level converter from 5 V to 3.3 V to protect the esp8266 RX pin.

Many thanks Juraj. It’s solved our problem. Many many thanks as we are struggling with this quite many days.


text:
int on Uno more than 16 bit?
So I'm playing with a TFT screen and trying to understand the colourspace encoding.  I wrote a quick for loop to show colours from 0 to FFFF and to print the value of colour being displayed:
for (int q=0; q<0xFFFF; q+=0x80) {
  tft.fillScreen(q);
  tft.setCursor(0, 0); tft.println(q, HEX);
  delay(2);
}

I was surprised to find values greater than FFFF being displayed - which suggest that int is more than 16 bits.  It's running on a Uno.
What has happened?
(PS I now understand RGB565 encoding, so this is off-topic)

Socco, Shall we close this question? Next time start by telling us which tft screen you have and that you are using the adafruit gfx library and if possible show a working sketch. The tft.fillScreen has a unsigned 16-bits parameter. A value above 0xFFFF rolls over and starts from 0x0000 again.

I guess you're seeing some big numbers starting with FFFF...?
What you are seeing is not big numbers - it's misrepresented numbers.
You have an int. That's not a "16-bit number", it's a 15-bit number plus a sign bit.
When you print it the variable is promoted to a long and the sign bit is extended.
That long is then further mapped (cast) into an unsigned long to print it as hexadeximal (there is no negative in the hexadecimal representation on Arduino), and that extended sign bit is seen as a string of F.
For example, the value 0xABCD stored in an int is:
 1 010 1011 1100 1101

I broke off the first bit because that is the sign bit in a signed integer.  The actual decimal value of that is -21555.
Now when that gets cast to a long the sign extension copies the leading sign bit to all the other 16 bits to the left of it, resulting in:
1 111 1111 1111 1111 1010 1011 1100 1101

Because of the way that twos complement works, that string of bits still represents -21555 in decimal.
However, cast it to unsigned long for printing as HEX and you can see how you would end up with some big numbers.  It would give you:
FFFFABCD

So you can see that a 16 bit signed value can end up being printed as 8 hex digits, and all because of the way the print() function in the Arduino API works.
When working with unsigned values you really should be working with an unsigned variable - especially if those unsigned values (0 - 65535) fall outside the range of the signed variable type (-32768 - 32767).  Switch to using uint16_t and you will be able to both store and represent the values correctly.

You might find it useful playing around with this site to learn how different variable types represent and store the data within them as binary.

Thank you for your detailed explanation @Majenko - quite informative for me.  (1) However the display does not show leading FFFFFs - for example it now shows 26C E000 .  (2) I guess the for loop will never exit because 0xFFFF will always be greater than the evaluation of max signed int =0x7FFF  - (3) But this still does not explain why the display is showing numbers greater than 16 bit capacity, which suggests the print command is being given a number greater than 16 bits.  (4) The Uno is a Chinese clone received with other hardware - so maybe this is relevant?

It won't be because it's a chinese clone - it's still the same software running on the same processor - even if it is one from the rejects bin. You loop certainly will never end. You should change to an unsigned value that is larger than your maximum loop value. Use uint32_t instead for your loop, then cast it to uint16_t for your colour value.


text:
How much voltage and current can a Arduino uno digital input sink?
I am having a digital output of 24VDC and 0.5A from ABB IRC5 controller. I need to feed this digital output to the digital input of Arduino uno. How can I do that?

Do you want to sink the voltage, or detect it?

just to detect sir

Why are you asking about current then? That's like asking "how heavy an aircraft can I see in the sky with my telescope?". Just to detect it, you don't care about its weight. And to detect a voltage, you don't care about its current (unless the current is very very tiny).

One common misconceptions is that the current limit of a GPIO pin applies to inputs.  It does not.
The 40mA "maximum sink" is only applicable when the pin is set to OUTPUT and is driven LOW - at which point the pin is connected to ground through a MOSFET.

Read: What Exactly is a GPIO Pin?

However, when the pin is in INPUT mode it is high impedance.  This means that it neither sinks nor sources current (apart from a very tiny leakage current).  The only thing that matters is the voltage.  That must:

Never go higher than 0.3V above VCC (5.3V if powered from 5V)
Never go lower than -0.3V
Have logic levels that are within the thresholds of the input:

Below 0.3 × VCC for LOW
Above 0.6 × VCC for HIGH

You can connect the input to a signal that is 5V and 1,000,000 giga-amps and all will be well.
However, if you inadvertently set the pin to OUTPUT and drive it LOW there will instantly be smoke.  For this reason it is common to add a small inline resistor (maybe 100Ω-470Ω) in order to limit any current through the circuit should the pin ever be set to OUTPUT and LOW.
Another "However", though:  If you are using a voltage divider to reduce your incoming voltage to conform to the values above (as shown by @user43648 and suitable values given by @EdgarBonet) the inline resistor is pointless. The voltage divider itself will have a very high output impedance which massively limits the current. This impedance is like having a resistance equivalent to both the provided resistors in parallel inline with your input.

Which will be the better option for me to step down the voltage sir? plz dont mind sir, I am mechanical guy having very very little knowledge in this area.

@SriHarsha As long as you're not dealing with high frequencies a simple voltage divider will suffice. – Majenko

Can you please share a link regarding this sir? I wanna go through it

Regarding voltage dividers? https://en.wikipedia.org/wiki/Voltage_divider

The link was really very helpful. Thank you @Majenko. You earned +1.

You have 2 different questions here. First one can be answered by google search, it is literally the first result.
The Arduino Uno uses the atMEGA328 microcontroller, which has an absolute maximum rating of 40 mA source or sink per GPIO. Also, the total current through the supply or ground rails (i.e. the total of all current OP wants the GPIO pins to sink, or source) is rated to a maximum of 150 200 mA.
And you should not apply more than 5V.
Regarding second question, Google can help again.

Vin is your 24V from controller, Vout is your Arduino digital 5V input. With that established, use voltage divider formula to calculate R1 and R2 values. I hope you can do that?
That being said, I am disappointed, because I feel like you have put 0 effort into researching this.

As a complement to user43648's answer, it is worth noting that:

According to the datasheet, the 40 mA limit “is a stress rating
only and functional operation of the device [...] is not implied”
beyond the maximum tested current which is 20 mA.
The input voltage should be at least 3 V for the pin to be
guaranteed to read high.
When sensing voltage through a voltage divider, 10 kΩ is a
somewhat typical order of magnitude for the resistors.

Given the above, I would suggest using 47 kΩ for the top resistor
and 10 kΩ for the bottom one. This should give about 4.2 V on
the input pin, which is near the middle of the appropriate range for the
pin to read HIGH.

Sir, should we not bother about the current? What will the current output?I am a mechanical guy, I don't have any idea regarding these things... please kindly help...

You will read the high/low level of the pin with digitalRead().  The input current will be 1uA max, 0.000001A. Practically nothing.  pinLevel = digitalRead(inputPin);

In addition to the potential divider I would be tempted to strap the input pin to ground with a zener diode between 4V7 and 5V1 in case the lower resistor or its solder joints fail. even with a relatively high value series resistor 24V has plenty of potential to destroy the input pin if not the entire chip. The safest method though is use an opto-isolator and keep the nasty high voltages isolated from the delicate digital level components.


text:
Garbage stored in SD card
I am an electronics graduate and an embedded design engineer, working in this field for about two years apart from the hobby time during my graduation. I am currently working on a system that has an Atmega2560 as the core controller with an arduino bootloader, we are using an 8GB memory card to save the log data from our system and send it to our server at regular intervals of time. The system worked fine however some of them are facing issues with the writing of data, some garbage value are getting stored in the SD card. I have attached the schematic and code snippet for the same, please let me know if there is any problem with the system and how can i resolve it, please let me know if any other things are required for understanding the problem correctly.
Thank you in advance.
     SD_Initialize();
  if(!SD.exists(SDTransactionDirectory))
  {
    if(SD.mkdir(SDTransactionDirectory))
    {

    }
  }
  RTC_Date_Time();
  String FileName = SDTransactionDirectory + "/" + RTCSDDate + RTCSDTime + ".txt";
  SD_File = SD.open(FileName, FILE_WRITE);
  if(SD_File)
  {
    delay(100);
    digitalWrite(LED_SD, HIGH);
    SD_File.println(GSMData);
    SD_File.close();
  }

The SD_Initialize() is a user function:-
void SD_Initialize()          //initialise SD card
{
  digitalWrite(SD_EN, HIGH);
  digitalWrite(SD_CS, LOW);

  delay(500);

  if(SD.begin(SD_CS))
  {
    digitalWrite(LED_SD, HIGH);
  }
  else
  {
    digitalWrite(LED_SD, LOW);
  }
}

The data stored in the filename is as follows:-
CLEnT|T|M008|\00Ÿûmï°]ŸëÜ£·zoòTÏæ{Œü[ŸýUô~ÛcCWY®ÞgÙë×<;wBÄgnìÇFÿÉ=XoÎ.êžÄf·®ö¯³ç~åeÝ]1_ÏÀyÿÌÍ?ô"zBõ¬ñ
As you can see the initial values till "M008" is fine but its garbage after that, and the CLEnt|T|M008 is the start of the string after that a lot of other parameter information is to be stored which turns out to be garbage.

Are the filenames garbage as well or only the content of the files? Is the garbage only on certain sd cards of a certain brand or type? What does the garbadge look like?

Is GSMData a String? You should avoid String and all String-based concatenation operations. Even on a Mega2560 with that little extra bit of SRAM it's still "iffy".

Are all files being written?  Does RTCSDDate and RTCSDTime contain illegal Filename characters?

@Jot The filenames are correctly stored however the data written is garbage, i have added an edit to let you know about the data stored in the card. Its not dependent on brand and type since we are using the SD card for all the systems.

@Majenko yes it is a string variable, can you please suggest any other way to store the data to that particular card, the data is about 200 characters.

@CodeGorilla yes the files are being made with correct names however only the data is out of the desired format.

You said: "Its not dependent on brand and type since we are using the SD card for all the systems.".  Did you mean to say you are using "different SD cards for each system"?  Also, check your power supply current capabilities and dependability.  Consider the possibility of voltage fluctuations causing corruption in the processor, communications between the processor and the SDCard and in the SDCard.

@st2000 we are using the same SD card brand and type in all the systems, we are using an MPTT based regulated supply which is further converted to 5volts for proper operation. It has sufficient power rating for upto 2A output rating.

The example data starts CLEnT|T|M008|\0; is the \0 an actual sequence of the two characters "" and "0"? It may be coincidence, but it looks suspicious to see the escaped null char just before the "corrupt" data. Makes one think String termination problems.

Can you confirm exactly what should be saved? Should the M008| be the last value saved? In other words, what do you expect to see?

@shwetankvishnu https://majenko.co.uk/blog/evils-arduino-strings

Likely, SDCards are not alike between OEMs.  Further, there are counterfeit SDCards on the market.  It would have been more ideal if you had used different SDCards and identified any correlation between SDCards and observed unexpected behavior.

There are many comments, but no answer yet. This answer has only a few basic rules.
The first thing to do is to see if the problem can be replicated with a small sketch and to check the voltages.
The arduino mega 2560 works best at 5.0V, or maybe a little less. It is not reliable at 4V. When powering it with a 5V power supply, the usb connecter is the best option to power the arduino board. Powering the arduino board via the 5v pin is not advised. When a strong power supply is connected to the 5v pin, the voltage regulator can be blown.
When something is not working, fall back to something that is reliable. For example a SD module with a HC4050 to shift the voltage levels. The resistors make the signal weaker.
Make a small test sketch without the use of the String object. The more experienced someone is with arduino, the more he or she tells to avoid the String object with avr microcontrollers.
There are counterfeit SD cards. One of those might turn up in your hands someday. Beside that, not every SD card is compatible with the arduino SD library.
In your situation it is suspicious that the file system is okay, the filenames are okay, the first text is okay, but when data is written it suddenly goes wrong. That is a strong indication for a memory problem.
When data to a display or SD card is wrong, then send it also to the serial monitor. You have to know what is actually written to the SD card.

hi @jot thank you for concluding the comments and pointing out the possible issues,

The power supply is well regulated and filtered using a DC-DC buck convertor which is getting an input from an 18-36Volt SMPS with upto 5A current rating. And I am using the Atmega2560 chip with an arduino bootloader, not the arduino board itself.
I am looking forward for making change in the hardware to use the HC4050 to check the response
Checked the sample sketch and worked fine like most the systems. Note this problem is with few systems not alll
I formatted all the cards with a FAT b4 using

I have asked to ship the system from site and once i get it will check the serial monitor to see whats going around.


text:
Arduino IDE does not display examples folder from my custom library
I have created a custom library for local usage. I call is ABC_node for ESP32 and the structure is as follows:
.
|-- examples
|   |-- bnoCalibStorage
|   |   `-- bnoCalibStorage.ino
|   |-- influxHTTP_write
|   |   `-- influxHTTP_write.ino
|   |-- influxPing
|   |   `-- influxPing.ino
|   |-- influxUDP_write
|   |   `-- influxUDP_write.ino
|   `-- rtcTimestamp
|       `-- rtcTimestamp.ino
|-- keywords.txt
|-- library.properties
|-- README.md
|-- ABC_Node.cpp
`-- ABC_Node.h

I tried following the Adafruit GitHub Repository structure where each example is placed inside a folder named after the sketch.
I am hosting this repository on a private GitLab Server. I used git tag v1.0.0 to create a tag and from GitLab I could download the .zip file for the stable v1.0.0 library.
I manually extracted the files to my <user>\Documents\Arduino\libraries folder and renamed the folder to ABC_Node (since my gitlab repo is named something else)
I restarted my IDE but I could not find the library ABC_Node in
Sketch\Include Library\

library.properties
name=ABC_Node
version=1.0.0
author=Shan Desai
maintainer=Shan Desai
sentence=Firmware to create InfluxDB measurements and send them via HTTP/UDP to Core
paragraph=ABC_Node provides `String` based InfluxDB measurements which can then be sent via HTTP/UDP to a central InfluxDB instance.
category=Data Processing, DAQ
architecture=ESP32
repository=https://[gitlab-address]/node-repo.git

I followed the Libraries Guide from Arduino on local Installation
System
Windows 10
Arduino IDE 1.8.5

Your library.properties is lacking a line.  Emulating your library with blank files and copying in your library.properties content, and running on Linux from the command line, it reports to me:
Invalid library found in /home/matt/Arduino/libraries/ABC_Node: Missing 'url' from library

So you lack the line:
url=https://whatever.website.you.want.to/point.to

(Or use something like http://example.com if you don't want one...)
I put that line in, and magically the library appears in the list.

Can you tell me what commandline you used here ?

You just run the Arduino program. No need for any options or anything.

so just execute it from the IDE?

Pardon?  Execute what from the IDE? On Linux at a BASH terminal prompt I typed, precisely, /home/matt/Downloads/arduino-1.8.5/arduino and it gave me that error on the screen as the IDE loaded.  I doubt you can do the same on Windows though...

That was what I was expecting as an answer. The commandline tool arduino. You are right it I am not sure if I can execute arduino on CMD or Powershell. Thanks.

You can run it from the command line, but whether it would give you any meaningful output on the command line is anyone's guess. You may want to run java -jar <path/to/arduino/jar/file> - you'll have to work out where the right jar file is though...


text:
Standard Practice for including custom library in examples folder
I have created my custom library with examples folder in them. The main header file is ABC_Node.h. I am referring the structure of Adafruit libraries for Arduino and in some repos under the examples folder I found a conflict for the inclusion of their header files.
Example
in some repos. they use double quotes ("") for including their header files e.g. #include "Adafruit_SHT31.h"
SHT31test.ino
on the contrary, in their BNO055 Arduino library they use brackets (<>) #include <Adafruit_BNO055.h> BNO055 Bunny sketch
I locally tested my library on the IDE and I have examples in which my library is in #include "ABC_Node.h" and it compiles without a problem.
Soon I wish to make the repository public and want to know if there is a standard practice for including header files for examples.

You can use either. There is no "standard".
When using a raw C compiler there is a difference between the two as regards the order in which directories are searched for files to include, but with the Arduino that is completely irrelevant, so either can be used.
Personally I use <...> for libraries and "..." for header files that form part of the sketch.  It makes for easier identification of which is which, and conforms to the C standard of <...> for system-installed headers, and "..." for local headers.

me too :-) (123)


text:
My verbose appears "unable to cache built core"
At early morning i have accidentally the error of GNOME for my OS, so I was forced reinstall my OS couse i don't have any backup for my packages and my database. i'm installed Arduino-IDE 1.8.7, Arduino AVR Boards 1.6.23 and Esp8266 Boards 2.4.2 . when i trying to upload my sketch, i get this error:
...
Unable to cache built core, please tell esp8266 maintainers to follow http://goo.gl/QdCUjo
...

I see the link, but i cannot see where my archive variable in platform file for my cores.
...
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/arduino.ar" "{object_file}"
...

See my verbose log !!!.
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_988288/arduino.ar /tmp/arduino_build_988288/core/spiffs_api.cpp.o
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_988288/arduino.ar /tmp/arduino_build_988288/core/spiffs_hal.cpp.o
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_988288/arduino.ar /tmp/arduino_build_988288/core/time.c.o
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_988288/arduino.ar /tmp/arduino_build_988288/core/uart.c.o
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_988288/arduino.ar /tmp/arduino_build_988288/core/umm_malloc/umm_malloc.c.o
Unable to cache built core, please tell esp8266 maintainers to follow http://goo.gl/QdCUjo
Linking everything together...
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc -CC -E -P -DVTABLES_IN_FLASH /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/ld/eagle.app.v6.common.ld.h -o /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/ld/eagle.app.v6.common.ld
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc -Wl,-Map -Wl,/tmp/arduino_build_988288/tesHC139.ino.map -g -w -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static -L/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/lib -L/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/ld -L/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/libc/xtensa-lx106-elf/lib -Teagle.flash.4m1m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o /tmp/arduino_build_988288/tesHC139.ino.elf -Wl,--start-group /tmp/arduino_build_988288/sketch/tesHC139.ino.cpp.o /tmp/arduino_build_988288/libraries/SPI/SPI.cpp.o /tmp/arduino_build_988288/libraries/Adafruit_BME280_Library-master/Adafruit_BME280.cpp.o /tmp/arduino_build_988288/libraries/Wire/Wire.cpp.o /tmp/arduino_build_988288/arduino.ar -lhal -lphy -lpp -lnet80211 -llwip2 -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group -L/tmp/arduino_build_988288
/home/praz/.arduino15/packages/esp8266/tools/esptool/0.4.13/esptool -eo /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/bootloaders/eboot/eboot.elf -bo /tmp/arduino_build_988288/tesHC139.ino.bin -bm dio -bf 40 -bz 4M -bs .text -bp 4096 -ec -eo /tmp/arduino_build_988288/tesHC139.ino.elf -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
Using library SPI at version 1.0 in folder: /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/SPI
Using library Adafruit_Sensor-master at version 1.0.2 in folder: /home/praz/Arduino/libraries/Adafruit_Sensor-master
Using library Adafruit_BME280_Library-master at version 1.0.7 in folder: /home/praz/Arduino/libraries/Adafruit_BME280_Library-master
Using library Wire at version 1.0 in folder: /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/Wire
/home/praz/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-size -A /tmp/arduino_build_988288/tesHC139.ino.elf
Sketch uses 259408 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 28352 bytes (34%) of dynamic memory, leaving 53568 bytes for local variables. Maximum is 81920 bytes.
/home/praz/.arduino15/packages/esp8266/tools/esptool/0.4.13/esptool -vv -cd nodemcu -cb 115200 -cp /dev/ttyUSB0 -ca 0x00000 -cf /tmp/arduino_build_988288/tesHC139.ino.bin

I don't think so if i have permissions issue, it seems my boards is fine about my permissions.
total 388
drwxrwxr-x  8 praz praz   4096 Okt 11 00:14 ./
drwxrwxr-x  3 praz praz   4096 Okt 11 00:13 ../
-rw-rw-r--  1 praz praz 293575 Agu  3 14:19 boards.txt
drwxrwxr-x  3 praz praz   4096 Agu  3 14:19 bootloaders/
drwxrwxr-x  3 praz praz   4096 Agu  3 14:19 cores/
-rw-rw-r--  1 praz praz    235 Agu  3 14:19 .gitmodules
-rw-rw-r--  1 praz praz   2831 Agu  3 14:19 ISSUE_TEMPLATE.md
-rw-rw-r--  1 praz praz    553 Agu  3 14:19 keywords.txt
drwxrwxr-x 28 praz praz   4096 Agu  3 14:19 libraries/
-rw-rw-r--  1 praz praz  26529 Agu  3 14:19 LICENSE
-rw-rw-r--  1 praz praz    194 Agu  3 14:19 package.json
-rw-rw-r--  1 praz praz   6844 Agu  3 14:19 platform.txt
-rw-rw-r--  1 praz praz   7136 Agu  3 14:19 POLICY.md
-rw-rw-r--  1 praz praz      0 Agu  3 14:19 programmers.txt
-rw-rw-r--  1 praz praz   7722 Agu  3 14:19 README.md
drwxrwxr-x  4 praz praz   4096 Agu  3 14:19 tests/
drwxrwxr-x  3 praz praz   4096 Agu  3 14:19 tools/
drwxrwxr-x 25 praz praz   4096 Agu  3 14:19 variants/

Solved
I think when i installed Esp8266 Boards 2.4.2 latest version is fine, i uploaded my sketch and i cannot make cache to my built core, Majenko is right, my the snippet of config are difference between my 74hc139 issue and my verbose log issue.
when i installed fresh Esp8266 Boards using boards manager, that automatically downloads source code of esp8266 core on this Github, i don't understand why my snippet of config not updated like this commit. so i updated my config of boards with copy/paste on tree links of  Github, and that's works.
See my verbose below or see at this :
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_979295/core/core.a /tmp/arduino_build_979295/core/sqrt32.c.o
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_979295/core/core.a /tmp/arduino_build_979295/core/time.c.o
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_979295/core/core.a /tmp/arduino_build_979295/core/uart.c.o
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar cru /tmp/arduino_build_979295/core/core.a /tmp/arduino_build_979295/core/umm_malloc/umm_malloc.c.o
Archiving built core (caching) in: /tmp/arduino_cache_39139/core/core_8e365e854c5bfceaa27f4c371ba290d0.a
Linking everything together...
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -CC -E -P -DVTABLES_IN_FLASH /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/ld/eagle.app.v6.common.ld.h -o /tmp/arduino_build_979295/local.eagle.app.v6.common.ld
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc -Wl,-Map -Wl,/tmp/arduino_build_979295/tesHC139.ino.map -g -Wall -Wextra -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static -L/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/lib -L/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/ld -L/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/sdk/libc/xtensa-lx106-elf/lib -Teagle.flash.4m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o /tmp/arduino_build_979295/tesHC139.ino.elf -Wl,--start-group /tmp/arduino_build_979295/sketch/tesHC139.ino.cpp.o /tmp/arduino_build_979295/libraries/SPI/SPI.cpp.o /tmp/arduino_build_979295/libraries/Adafruit_BME280_Library-master/Adafruit_BME280.cpp.o /tmp/arduino_build_979295/libraries/Wire/Wire.cpp.o /tmp/arduino_build_979295/core/core.a -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group -L/tmp/arduino_build_979295
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/esptool/esptool -eo /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/bootloaders/eboot/eboot.elf -bo /tmp/arduino_build_979295/tesHC139.ino.bin -bm dio -bf 40 -bz 4M -bs .text -bp 4096 -ec -eo /tmp/arduino_build_979295/tesHC139.ino.elf -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
Using library SPI at version 1.0 in folder: /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/SPI
Using library Adafruit_Sensor-master at version 1.0.2 in folder: /home/praz/Arduino/libraries/Adafruit_Sensor-master
Using library Adafruit_BME280_Library-master at version 1.0.7 in folder: /home/praz/Arduino/libraries/Adafruit_BME280_Library-master
Using library Wire at version 1.0 in folder: /home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/Wire
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-size -A /tmp/arduino_build_979295/tesHC139.ino.elf
Sketch uses 265524 bytes (25%) of program storage space. Maximum is 1044464 bytes.
Global variables use 28236 bytes (34%) of dynamic memory, leaving 53684 bytes for local variables. Maximum is 81920 bytes.
/home/praz/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/tools/esptool/esptool -vv -cd nodemcu -cb 115200 -cp /dev/ttyUSB0 -ca 0x00000 -cf /tmp/arduino_build_979295/tesHC139.ino.bin

Hope anyone can solve my issue, Thanks in advance.

turn on in Preferences the verbose output for console. you will see the path

@Juraj i turn on at my command line absolutely.

You may have some file permission errors in tour home directory. Check ownership.

Juraj i'm on my Ubuntu, Majenko i don't think so i have permissions issue.

Juraj Majenko see my verbose http://paste.ubuntu.com/p/2n6GVkgM3m/

The snippet of config you show doesn't match with what is currently in the Github repo for the ESP8266 core. Make sure you have the latest version of the core installed.

@Majenko you're right, i see my verbose on 74h138 chip issue and this verbose have difference xtensa tools, i just update my source code of tools.

This was fixed on the 20th August in this commit. Make sure you have the latest version of the ESP8266 core installed. If there hasn't been a release since that fix, you can pull the github version of the config file and use that instead of the one bundled with the core.
However, it's not a fatal error - it merely means that compilation will be slower than it should be.

Thanks, i think so, i found it too, i still editing before.


text:
Is there a board that can act as both a USB host and client for HID devices?
Trying to build an arduino-based Mouse/Keyboard enhancer.  This will let me do things like press certain keyboard or mouse shortcuts on the input side, then do something custom on the output side.  For instance, this would let me add keyboard shortcuts at the hardware level instead of having to do them at the OS level.
As such, I'm looking for a board which can act both as a USB host (i.e. it can have a keyboard and mouse plugged into it) as well as one that can show up as a USB HID device to the computer it's plugged into.
The boards that I'm aware of which have something close to this are the Leonardo and chip-similar, which work to emulate a keyboard/mouse to the computer they're attached to, but which don't let you connect a keyboard/mouse to them.
So is there such a board?

Leonardo + USB Host Shield?

Trying to keep it on a really small board like a trinket (which I'm seeing if it already does what I need.) I'm planning on making this so it's like a thumb drive that plugs inline into a computer (i.e. Keyboard/Mouse-->This device--> Computer)

You require a chip with two usb peripherals in it, one of which at least has host capabilities. I only know of one chip family with that off hand and I haven't ported it to Arduino yet. Maybe there is as ST arm chip with it.

Well I know the ZERO (and I'm guessing other SAM/M0-based boards) supports both host and device, but even though it has two USB ports, it doesn't look like it does so simultaneously. One seems dedicated to serial/programming while the 'native' one can be used for both.

They only have one usb port. The other is connected through a usb to UART adapter to the serial port. You need one with two natives. I only know of the PIC32MM series that has that in a small MCU, and as I say I haven't ported that sub family of the PIC32 yet, though it is on the cards...  Along with host support for the USB stack for PIC32...  The Beaglebone Black has both host and device ports, but that is a Linux embedded computer and too big and complex.

Hey… I just checked out your profile and see that you do board design and help with manufacturing. I’ve actually been looking for someone to help me with several board Designs for several different projects for a while. How can I reach out to you personally about this?

Use the contact form on my website (majenko.co.uk)

The TMK USB to USB converter is a thumb drive sized board with ATMega32u4 and max3421e with pass through/remapper software. It has the same functionality as a Leonardo with USB host shield.
https://geekhack.org/index.php?topic=69169.0

This looks promising.  I'm asking there too, but do you know if this can be used exactly like a Leo with the Host shield (i.e. can I use my own custom firmware, even if I have to flash a boot loader on it manually?)


text:
How would I go about measuring an analog signal on my arduino mega that has both positive and negative voltages
I have a signal that fluctuates between -70mV and 50mV. How would I get the arduino to read this.. Ultimately I am trying to graph the data in real time so it looks like this.

https://i.stack.imgur.com/a8zIE.jpg

i don't think an arduino has much sensitivity (precision) between such close values. I would use an op amp to amplify it to ~0-5v, after it went through a voltage sum circuit, a dual op amp like the 358 will  let you do both with one chip.

You need to amplify your signal and add 2.5V as a "virtual ground" for the amplification. This gets a little tricky, since you need a low-impedance VCC/2 source to feed the amplifier as a virtual ground.  This would require a unity-gain buffer fed from a voltage divider:

simulate this circuit – Schematic created using CircuitLab
Now you use that to feed the amplifier:

simulate this circuit
The gain is set by 1+(RF/RG), or 11 in this case, giving you -0.77V to +0.55V.
There is a simpler option, though. (There is another intermediate option but the editor lost it and I can't be bothered to spend the time recreating it).
This method does come at a cost, though: it inverts the signal. The -0.07 becomes 0.07 and the 0.05 becomes -0.05, and multiplied by the gain and added to the offset:

simulate this circuit
Here you get a transformation from -0.07V - +0.05V to +0.7V - -0.5V.  That means that in software you then have to invert the value (simply subtract it from 0 after removing the DC offset).
You're basically shifting some of the complexity out of the circuitry and into the software.
Personally I use the inverting amplifier (the last circuit) because the virtual ground current is near zero, so you don't need a low impedance VCC/2 voltage source. It's also easier to create more sensible gains (like 10x) than the non-inverting amplifier, which always has 1 added to the gain.

Your second circuit doesn't have a well defined DC working point.

Quite possibly not. I was having a nightmare of a time with the editor. It kept wiping stuff out and crashing and deleting circuits.

@EdgarBonet The op-amp was upside down in the non-inverting second stage... oops...

Here is my try at this: if your voltage source doesn't mind sinking
something like 150 µA, you could try something like this:

simulate this circuit – Schematic created using CircuitLab
This should map the input range [−70 mV, +50 mV] to
[0.04 V, 4.06 V].


text:
Why are my if statements acting like the condition is always true?
Here is my code. My issue is is that the keys are getting "pressed" even though there is nothing jumping any of the pins on the Arduino.
// UNO-HIDKeyboard-Library - Version: Latest
// This program has been created by pcs3rd.
// Please do not change this line.
#include <HIDKeyboard.h>
HIDKeyboard keyboard;   // Initiate keyboard
// Pin deffanitions and variables...
int key0 = 2;   // Button 0 (Unused but optional)
int key1 = 3;   // Button 1
int key2 = 4;   // Button 2
int key3 = 5;   // Button 3
int key4 = 6;   // Button 4
int key5 = 7;   // Button 5
int key6 = 8;   // Button 6
int key7 = 9;   // Button 7
int key8 = 10;  // Button 8
int led0 = 13;  // Indicator light.
int state0 = 0; // Button 0
int state1 = 0; // Button 1
int state2 = 0; // Button 2
int state3 = 0; // Button 3
int state4 = 0; // Button 4
int state5 = 0; // Button 5
int state6 = 0; // Button 6
int state7 = 0; // Button 7
int state8 = 0; // Button 8

void setup() {
   keyboard.begin();    // Start keyboard emulation
   Serial.begin(9600);  // Start Serial Output
   delay(300);          // Wait to be recognized be PC.
   pinMode(key1, INPUT_PULLUP); // set pin mode
   pinMode(key2, INPUT_PULLUP); // set pin mode
   pinMode(key3, INPUT_PULLUP); // set pin mode
   pinMode(key4, INPUT_PULLUP); // set pin mode
   pinMode(key5, INPUT_PULLUP); // set pin mode
   pinMode(key6, INPUT_PULLUP); // set pin mode
   pinMode(key7, INPUT_PULLUP); // set pin mode
   pinMode(key8, INPUT_PULLUP); // set pin mode
   pinMode(led0, OUTPUT);       // set pin mode
   Serial.println("Startup Completed!");
}

void loop() {
   // write state info to vars
   state0 = digitalRead(key0); // Button 0
   state1 = digitalRead(key1); // Button 1
   state2 = digitalRead(key2); // Button 2
   state3 = digitalRead(key3); // Button 3
   state4 = digitalRead(key4); // Button 4
   state5 = digitalRead(key5); // Button 5
   state6 = digitalRead(key6); // Button 6
   state7 = digitalRead(key7); // Button 7
   state8 = digitalRead(key8); // Button 8
   if (state0 == HIGH) {       // Button 0
     digitalWrite(led0, HIGH);
     // keyboard.pressSpecialKey(0x68); (You can enter a scancode instead of 0x68,)
     Serial.println("state0");
     delay(30);
   }
   if (state1 == HIGH) { // Button 1
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x68);
     Serial.println("state1");
     delay(30);
   }
   if (state2 == HIGH) { // Button 2
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x69);
     Serial.println("state2");
     delay(30);
   }
   if (state3 == HIGH) { // Button 3
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x6A);
     Serial.println("state3");
     delay(30);
   }
   if (state4 == HIGH) { // Button 4
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x6B);
     Serial.println("state4");
     delay(30);
   }
   if (state5 == HIGH) { // Button 5
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x6C);
     Serial.println("state5");
     delay(30);
   }
   if (state6 == HIGH) { // Button 6
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x6D);
     Serial.println("state6");
     delay(30);
   }
   if (state7 == HIGH) { // Button 7
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x6E);
     Serial.println("state7");
     delay(30);
   }
   if (state8 == HIGH) { // Button 8
     digitalWrite(led0, HIGH);
     keyboard.pressSpecialKey(0x0F);
     Serial.println("state8");
     delay(30);
   }
   digitalWrite(led0, LOW);
   Serial.println("scan");
   delay(30);
}

Yet, even though I have 'if' statements, the code still gets executed, as shown in my monitor:
Startup Completed!
state0
hstate1
istate2
jstate3
kstate4
lstate5
mstate6
nstate7
state8
scan
state0
hstate1
istate2
jstate3
kstate4
lstate5
mstate6
nstate7
state8
scan

Are there any hints to what could be going on? I reformatted the code for readability, but it is pretty much the same as before. Also, I am not using pin 0 or one. I am using 13 for onboard LED.

Change state1 == HIGH etc. to state1 == 1.  Does that solve it?

@MichaelT ,as I just discovered through serial output, no it doesn't change anything. But I did discover that The code gets stuck at the first statement when I set to chech against HIGH but it racks through all of the statements if i set it LOW

how did you wire the 'keys'? to 5 V pin?  do you have pull-down resistors? did you really connect some button to pin1? and HID on Uno?

Welcome to Arduino:SE. You might find this post on our Meta site helpful: How to ask a good question for Arduino Stack Exchange.

The uno is capable of hid, just not at the same time as everything else, take a look at lufa. and I don't have any keys wired, therefore, none of the code in the statements should get executed @Juraj .Also, the question isn't about the code, its about why the code in the if statement is gettingexecuted even though the gpio pin(s) aren't ber\ing jumped to .

after you edited the question, you still have it wrong: with input_pullup pins are HIGH, if not connected to ground

Microcontroller pins tend to read LOW when left floating (but not always!). However, pin 1 is used to communicate with the USB-UART converter, and I believe it is set HIGH in the idle state. So assuming you are not pressing any buttons, keys 2-8 will be in the LOW state by default, but key 1 will be HIGH. Hence when defaultCase = HIGH;, the first if is triggered. When defaultCase = LOW; all if's but the first one fire up. Solution — don't use digital pin 1 (edit: avoid pin 0 and maybe 13 as well).
Edit: The answer above refers to the original code without the pull-up resistors enabled.

So i tried shifting all my pins to 2-9 and its still racking though all of the commands

@pcs3rd: you've tried it with the new version of the code? If so please please take note of Juraj's recent comment. You now have pull-ups enabled, and all the pins should be reading HIGH unless you start pressing buttons (assuming the buttons are connected to ground). Your ifs should be checking ==LOW in order to work correctly.

Oh. thats probably the issue then


text:
Reproducing a Fiber Optic Shape Sensor with Arduino?
I want to be able to track the curvature of a human arm as it straightens out and retracts (ex: like live tracking a bicep curl). I don't want to use resistive flex sensors.
I've been trying to find suppliers for this technology demoed here: https://www.youtube.com/watch?v=iAeXp-TpFLU&t=38s
But I cant seem to find anyone who sells directly to consumers. I was thinking about creating a hobbyist level version my own using fiber optic wire, a led, and a light wavelength sensor, using a more powerful Arduino such as the Intel Edison. I have a basic understanding of how this technology works, but I want to learn by attempting to create it.
Is this practical or possible with an Arduino?
if so:

Are these the correct materials I would need?

if not:

Why not?
What kind of equipment would I need to achieve this?
Is there anywhere to buy this sensor directly?
Are they any alternatives for 3D shape/position sensing besides 3D magnetic sensing?

how does the technology work? .... it is unclear from the video how much computing power is needed to calculate the position of the fiber optic cable ..... btw: there is no such thing as a fiber optic wire ... wire is metal

it is also unclear what kind of a sensor is used on the end of the optic fibre ..... it is most likely some sort of a multi cell sensor

Cable* is what I meant. Here is a video that explains the technology (0:50 start), https://www.youtube.com/watch?v=Kc3foeu2-50, from what I read, but again I have a limited understanding of this technology in depth, it measures the wavelength that is reflected back from the bragg gratings, in the video an oscilloscope is scene used, so I assume maybe an Intel Edison Arduino, since having a 500 MHz clock speed, maybe this is enough?

Likely you need to measure the time it takes for light to travel over a distance of fractions of a meter.  And light in a vacuum travels at about 3x10^8m/s.  This is the type of measurement a LIDAR based car navigation system only starts to approach.  Further, it is inferred the color of the light is important to measure.  The only test equipment I know of that might be capable of measuring the speed of light and the color of light are used in high speed fiber optics communication.  We're talking anywhere from the price of an expensive car to the price of a house.

I think nobody here can really give you an answer, if this is possible with an Arduino, since we don't know enough about the technology and the nitty gritty things, that make this a difficult task. So making a hobbyist version won't be easy and maybe really expensive.
In the fiber each bragg grating reflects a bit of the light back. The wave length of this reflected light is dependend on the angle between light and grating. So you get a specific wave length back from each grating, that corresponds to the bending at that particular part of the cable. The task is to measure the many wave lengths, that are being reflected in the fiber, and match them to a particular part of the cable. Since they don't say, how they are solving this, I will mention some ideas here:

Spectral Measurement (Wave length):

From the video I guess, that they use white light to shine into the cable. The gratings will only reflect the wave lengths from this spectrum, that satisfy Bragg's law due to bending angle. You have to measure the wave length directly with a spectrometer. Mostly this is another grating, that will seperate the wave lengths spatially, so that you can measure the spectral structure by using a spatial sensor, for example a camera or a line sensor. You would have to correct for different wave length sensitivities of the camera.
Maybe they are only using a laser with 1 wave length. Then the bending would result in a change in intensity reflected from that grating. If you can seperate the signals from the different gratings good enough, you would be able to measure just the change in intensity, which would be easier, since you basically need just a photo transistor or similar for that wave length. (In this case you would need to calibrate the sensor each time as a straight cable and ensure, that the measurement is fast enough for the expected movement).

Matching of signals to each part of the cable: Here I guess, that they use a time-of-flight sensor, because I cannot think of anything else without further information. This is a really difficult problem, because most available sensors are not sensible enough for measuring quarter inches without being cheap in the first place. You will likely spend a lot of money for a sensor like this. And you building an own time-of-flight sensor with the wanted sensitivity may be as difficult as building the whole device in the first place.
Needed Parts: Also you will need the fiber itself, which is - as stated - not a normal glas fiber, which you can by everywhere. It is most likely a custom build and you will pay a lot of money, to get one of these. The light source is dependend on the spectral measurement above. For a white light it is important, that all wavelength should have as equal intensity as possible. You would also have to account for the spectral absorption and the overall absorption in the fiber, which restricts the sensitivity and possible lengths.

Is there anywhere to buy this sensor directly?

Most likely not. In the videos it seems like a device, that was developed by the NASA for a specific application. The video is a proposal for other companies to learn from the NASAs development, so the device is not consumer ready. But you might be able to get a paper about this device by searching the internet for it or by asking the NASA directly. This paper would contain way more information about the device as the videos.
All in all this would be an extremely difficult task. Since you came here (a simple Q&A site) with this difficult question, I think, that you are not really ready for this big of a task. Most likely even the developers at the NASA needed long and much money for this.

Are they any alternatives for 3D shape/position sensing besides 3D magnetic sensing?

I would propose to build a string of bending strips, which change their resistance according to the bending angle. You can use multiple strips for getting multiple readings for different parts of the human arm. With each strip you build a voltage divider and do an analog measurement. With a bit of calibration you should be able to measure the curls.

Thank you for all of this information, this will help me a great deal. About the bending strips specifically, is there a way to make a 3D bending strip? If we put two together in a fashion where one measures the strain forward and backwards and the other from left to right? And using the change in light intensity as you previously said, would an optical bend sensor be better/more precise? Also a problem with a flex sensor, it doesn't give you a different value if you bend it forward or backwards to be able to tell bend direction or am I wrong?

your arm does not really bend two ways, except for your wrist ..... on the wrist, place one sensor on each side .... one will extend and one will contract .... that will indicate the direction of bend

Well. is not impossible and the accepted answer is quite dark.
To use a FBG with an Arduino (I advise a ESP32) one needs to have a light* emitter and also a light receiver for the same end of the fiber. To achieve this, is used an unidirectional optical circulator coupled with both emitter, receiver and the FBG.
The difficulty is in finding those components suitable or sensing and at the same time inexpensive. That said, here https://europepmc.org/article/pmc/6651577 is an article depicting a portable FBG interrogator using a raspberry pi. The Pi uses a 120Mhz MCU , so a ESP32 MCU is also a suitable option.

in sum, it can be done quite easily.

(FWIW, Pi3 uses a 1.2GHz CPU, not 120MHz)

correct. howeverthe MCU in a Pi clocks at 120Mhz

I guess I don't understand what you mean by "the MCU in a Pi" here; can you be specific?

@Dave Newton,  since you know so much, why not answer this question by yourself or better, edit this one ?

Not sure why you're upset--I just don't understand what you're talking about; I don't know what part of an RPi would be called an MCU or what part of an RPi runs at 120MHz. Geez.


text:
ESP8266 - server.write() doesn't work
I have a few Arduinos with ESPs, one of which is set up to measure temperature, and I'd like to have it send commands to other connected Arduinos to perform various functions (open/close valves, etc.)
In other words, the only communication I need is for one server to hopefully broadcast to a few clients. I don't really need to discern which client is which.
I am struggling to make sense of some of the documentation, and this is new to me.
For starters, I'm just trying to get any communication at all functional before I do the next parts.
My server device is set up as a soft access point and a WiFiServer.
My server ESP code looks something like this:
#include <ESP8266WiFi.h>

const byte ON = 2;
const byte OFF = 1;
int message;

WiFiServer server(80);

void setup()
{
  Serial.begin(9600);
  WiFi.softAP("access", "point");
  server.begin();
}

void loop()
{
  server.write(ON);
  delay(1000);
  server.write(OFF);
  delay(1000);
}

My client code looks something like this:
#include <ESP8266WiFi.h>

const byte ON = 2;
const byte OFF = 1;
byte ip[] = {192, 168, 4, 1};
WiFiClient client;
int message;

void setup() {
  Serial.begin(9600);
  // connect to wifi.
  WiFi.mode(WIFI_STA);
  WiFi.begin("access", "point");

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

  // Now connect to server object
  if (client.connect(ip, 80) == 1) {
    Serial.println("Connected");
  } else {
    Serial.println("Not Connected");
  }
  delay(10000);
}

void loop() {
  if (client.connected()) {
    Serial.println("Waiting for Data");
    while(!client.available()) {}
    String message = client.read();
    Serial.println(message);
  }
}

The client code does connect to the server, and gets stuck at the "Waiting for Data" line, never getting out of the while (!client.available) loop, so it clearly isn't receiving anything.
I'm sure I must look super dumb here, can someone help me understand the proper way to do what I want to do? Stuff I have seen online is primarily client -> server communication. Do I HAVE to ping the server with something in order to receive something back?

In esp8266 Arduino before version 3, write was not implemented in WiFiServer.
In version 3 WiFiServer doesn't have write, but class ArduinoWiFiServer implements the print-to-all-clients functionality.
Documentation link: https://arduino-esp8266.readthedocs.io/en/3.1.2/esp8266wifi/server-class.html
I am the author of ArduinoWiFiServer class.