text:
Can TFT displays share the same RST?
I am trying to connect up to 5 TFT displays to one Arduino Uno R3 and use a multiplexer to control the output to each display. At the moment I am stuck being able to only write to a single one. Every time I try to add a second one I fail.
The displays I am using are here along with the pin allocations. https://www.waveshare.com/wiki/1.69inch_LCD_Module#Arduino
The process I am following is detailed here along with the schematic I am following. https://forum.arduino.cc/t/multiple-tft-displays-with-due-using-multiplexed-spi-cs/917473.
In the schematic you can see they are sharing the one reset pin. Additionally that pin is connected to the Arduino's native Reset pin.
I have copied the same design so that all my pins are shared apart from the CS pin. The CS pin from the Arduino goes to the signal pin of the multiplexer.
I can get that setup to work with a single display. However, as soon as I put the second displays reset pin into the same channel on the breadboard as the first displays pin, both screens no longer work. They are backlit, but there is no text appearing. Pull the second RST pin out again, reset the Arduino, and the first screen outputs text again.
I have taken the code from the example above and modified it a little to suit my displays. Below is the code I am using with comments that I hope explains it adequately.
After the initialization, I am adding a delay of 1000 ms in case the displays needed time to reset. Unfortunately, this didn't help either. I feel that adding the delay inside of the initialization loop won't help because as I understand it, the reset happens when the display gets power.
I am not an electronics person but I am a programmer by trade. So it's the code I understand and can modify. Where I am lacking is in being able to wire this up so that I can have the 5 displays hooked up.
I "think" that if I can solve the RST issue, that I should be able to write to the screens no problem, but right now that's a guess.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library
#include <SPI.h>

#define BLACK 0x0000
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF

// rst is declared as pin 8 but there is no pin in that socket
Adafruit_ST7789 tft = Adafruit_ST7789(10, 7, 8); // 10 = CS, dc, rst

void setup(void)
{
  // these outputs control the multiplexer chip
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);

  for (int n = 1; n < 3; n++)
  {
    SetDisplay(n); // selects the display
    tft.init(240, 280);

    tft.setTextColor(WHITE);
    tft.setRotation(2); // rotate to portrait

    tft.fillScreen(BLACK);
    tft.setCursor(15, 18);
    tft.print("DISPLAY ");
    tft.print(n);
  }
  delay(1000);
}

int value = 0; // this is what is rendered on screen
void loop()
{
  // Scroll through the two displays
  for (int M = 1; M < 3; M++)
  {
    SetDisplay(M);
    tft.fillRect(0, 25, 159, 128, BLACK); // fill the variable text area which clears the previous text
    tft.setCursor(15, 50);
    tft.print(String(value));
    value++;
  }
  delay(1000);
}

// This function selects the display by setting two binary outputs to the multiplexer chip
void SetDisplay(int DNo)
{
  if (DNo == 1)
  {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    tft.setTextColor(RED);
  }
  else if (DNo == 2)
  {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    tft.setTextColor(GREEN);
  }
}

Why the downvote? This seems like a pretty legit question with enough detail in it!

I did not vote down... -- Please [edit] your question and add the schematic, especially how you wired the CSs and RSTs. The analog multiplexer of the linked forum post is -hrm- not the best solution, as comments there say, too. -- For the given design, you need a voltage meter to measure the level on the RST wire. Measure the voltage for the different situations: 1st display alone, 2nd alone, or both displays, RST applied or not, any combination. You might need to write a simple extra sketch for this. -- What happens if connect the 2nd display just by power and RST, but no communication line?

@thebusybee, So you think it might be a power issue by the sounds of it? Let me try your questions later on tonight and get back to you. Thanks for the comment.

Well, "power" in the sense of existing impedances/resistors. For example, the schematic of the Uno R3 (which one do you use?) has just a 10kOhm pull-up on RESET.

I do have the R3 yes. Let me try those few things you suggested and get back to you likely tomorrow now. Again, thank you


text:
ERROR: return reinterpret_cast<T>(pgm_read_ptr(p));
I need to update DHT sensor data to the webserver in JSON format using ESP8266. This is my code.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <DHT.h>
#include <ArduinoJson.h>

const char* ssid = "YOUR_SSID";
const char* password = "YOUR PASSWORD";
const int dhtPin = D4;
DHT dht(dhtPin, DHT11);
ESP8266WebServer server(80);

void handleRoot() {
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  if (isnan(temperature) || isnan(humidity)) {
     server.send(500, "text/plain", "Failed to read from DHT sensor");
    return;
  }

  StaticJsonDocument<200> jsonDoc;
  jsonDoc["temperature"] = temperature;
  jsonDoc["humidity"] = humidity;

  String jsonString;
  serializeJson(jsonDoc, jsonString);

  server.send(200, "application/json", jsonString);
}

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

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }

  Serial.println("Connected to WiFi");
  dht.begin();
  server.on("/", handleRoot);
  server.begin();
  Serial.println("Server started");
}

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

But I got error like,
In file included from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/static_array.hpp:11:0,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Numbers/FloatTraits.hpp:14,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Numbers/FloatParts.hpp:8,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Json/TextFormatter.hpp:11,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Json/JsonSerializer.hpp:7,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Variant/ConverterImpl.hpp:7,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:37,
                 from c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from C:\Users\Kuralmozhi.R\Downloads\ID_2\ID_2.ino:5:
c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp: In instantiation of 'typename ArduinoJson6193_F1::enable_if<ArduinoJson6193_F1::is_pointer<T>::value, T>::type ArduinoJson6193_F1::pgm_read(const void*) [with T = const __FlashStringHelper*; typename ArduinoJson6193_F1::enable_if<ArduinoJson6193_F1::is_pointer<T>::value, T>::type = const __FlashStringHelper*]':
c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Deserialization/DeserializationError.hpp:85:12:   required from here
c:\Users\Kuralmozhi.R\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp:15:45: error: 'const void*' is not a pointer-to-object type
   return reinterpret_cast<T>(pgm_read_ptr(p));
                                             ^

exit status 1

Compilation error: exit status 1

I don't know how to solve this error. Please suggest me some ideas!

I tried to update ESP8266. But now it shows like this,
Variables and constants in RAM (global, static), used 28984 / 80192 bytes (36%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ DATA     1504     initialized variables
╠══ RODATA   1376     constants
╚══ BSS      26104    zeroed variables
Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60439 / 65536 bytes (92%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ ICACHE   32768    reserved space for flash instruction cache
╚══ IRAM     27671    code in IRAM
Code in flash (default, ICACHE_FLASH_ATTR), used 273120 / 1048576 bytes (26%)
║   SEGMENT  BYTES    DESCRIPTION
╚══ IROM     273120   code in flash

Please copy and paste the actual error, including the line number, not something "like" the error. Edit your question to do this.

Sounds like this problem.

I can't understand this problem. Can you explain briefly?

What version of the Arduino IDE are you using?

The page linked by Fahad suggested: I suggest you upgrade or reinstall the ESP8266 core for Arduino. If that's still not working, you can disable support for PROGMEM until we figure what's wrong (see ARDUINOJSON_ENABLE_PROGMEM).

What is your issue with the output after the update? In my eyes this looks like a successful build.

With the info from the link Fahad provided in the comments, I can only offer a guess: Your ESP8266 board definitions are outdated and the old version of the ESP8266 board definitions contains a bug.
There is an outdated URL to the ESP8266 board definition JSON floating around on the web. I guess you found that one. The URL still works, but is not updated anymore. Please check the version of your ESP8266 board definitions: Open the Board Manager (Tools -> Board -> Board Manager), search for ESP8266 and verify that the version is at least 3.1.2 (current version as of this writing; I don't know the lowest version where this bug is fixed).
If the Board Manager does not offer to update to version 3.1.2 (or later), you may need to provide the current URL to the board definitions in File -> Preferences -> Tab "Settings" -> Additional Boards Manager URLs. Remove the old ESP8266 URL, but don't remove URLs for other boards. Then try to update using the Board Manager again:
https://arduino.esp8266.com/stable/package_esp8266com_index.json

This works! Thank you so much orithena!!

source: Stack Exchange

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

sort: votes


text:
ESP32 trouble with running ledcWrite inside of ISR
ESP32-S2 (Wemos/Lolin S2 mini)
Arduino 2.1.1 on Windows 11
Hello,
Thank you for taking the time to read this post and for any assistance you can provide. I consider myself a newbie when it comes to the more advanced aspects of Arduino, such as hardware functions and 32-bit MCUs. I've spent the last three days working on this code segment from a much larger project, and have searched extensively online to accomplish a seemingly simple task. I hope I'm not wasting anyone's time by asking a question that may have been answered elsewhere in an LMGTFY.
My goal is to output two LED PWM channels using hardware timers to control the frequency and duty cycle of the strobing LEDs. Here are the specific requirements:

The LEDs need to be power-controlled (I've been using the ledc() function)
The LEDs should be able to be strobed at specific intervals within the range of 0 to 1kHz. I'm using hardware timers so blocking functions such as non-DMA SPI updates of the display does not interfere with the strobe.
The duty cycle of the strobe needs to be adjustable as a float percentage ranging from 0.01 to 99.99% uptime per cycle.

Unfortunately, I've encountered an issue where I can either (unreliably) time the strobe and duty cycle or (somewhat more reliably) control the PWM power modulation, but not both simultaneously. I've tried various combinations of timer bindings, ledc channels, timing libraries, ISR handling, and rewriting the code from scratch multiple times.
I apologize for the messy state of the code, as it has undergone numerous modifications, and I'm fried at looking at the code. I would greatly appreciate any assistance or pointers you can provide to help resolve this issue.
Thank you once again for your help!
#include <esp32-hal-timer.h>

// Pin assignments
#define LED_660    17
#define LED_850    16

// Intensity control variables (percentage)
int pwr_850 = 0;
int pwr_660 = 0;

// Strobe control variables
float led_hz = 1.0;   // Strobe cycles per second
float led_duty = 50.0;    // Duty cycle percentage

// Timing variables
volatile unsigned long on_time;
volatile unsigned long off_time;

hw_timer_t *timer_on = NULL;
hw_timer_t *timer_off = NULL;

bool leds_on = false;  // Flag to track the state of LEDs

void IRAM_ATTR onTimer() {
  ledcWrite(2, 254);
  ledcWrite(3, 254);
  timerAlarmDisable(timer_off);
  timerAlarmWrite(timer_on, on_time, true);
  timerAlarmEnable(timer_on);
}

void IRAM_ATTR offTimer() {
  ledcWrite(2, 0);
  ledcWrite(3, 0);
  timerAlarmDisable(timer_on);
  timerAlarmWrite(timer_off, off_time, true);
  timerAlarmEnable(timer_off);
}

void startLEDs() {
  ledcSetup(2, 4000, 8);  // 4 kHz PWM, 8-bit resolution
  ledcSetup(3, 4000, 8);  // 4 kHz PWM, 8-bit resolution
  ledcAttachPin(LED_660, 2);
  ledcAttachPin(LED_850, 3);
  if (led_hz == 0) {
    ledcWrite(2, (pwr_660 / 100.0) * 255);
    ledcWrite(3, (pwr_850 / 100.0) * 255);
    leds_on = true;
  }
  else if (!leds_on && led_hz > 0.0) {
    // Calculate on/off times based on strobe parameters
    unsigned long cycle_time = 1000000.0 / led_hz;  // Convert Hz to microseconds
    off_time = ((cycle_time * led_duty) / 100);
    on_time = (cycle_time - off_time);

    // Update timer alarms
    timerAlarmWrite(timer_on, on_time, true);
    timerAlarmWrite(timer_off, off_time, true);

    // Enable timers
    timerAlarmEnable(timer_on);
    timerAlarmEnable(timer_off);  // Enable this at the same time as timerOn
    leds_on = true;
  }
}

void stopLEDs() {
  if (leds_on) {
    ledcWrite(1, 0);
    ledcWrite(0, 0);
    timerAlarmDisable(timer_on);
    timerAlarmDisable(timer_off);
    leds_on = false;
  }
}

void setup() {
  pinMode(LED_660, OUTPUT);
  pinMode(LED_850, OUTPUT);
  pinMode(15, OUTPUT);

  // Create timers
  timer_on = timerBegin(0, 80, true);  // Timer 0, prescaler 80 (1MHz)
  timer_off = timerBegin(1, 80, true);  // Timer 1, prescaler 80 (1MHz)

  // Attach interrupts
  timerAttachInterrupt(timer_on, &onTimer, true);
  timerAttachInterrupt(timer_off, &offTimer, true);
}

void loop() {
  pwr_850 = 30;
  pwr_660 = 30;
  digitalWrite(15, 1);
  led_hz = 1;   // Strobe cycles per second
  led_duty = 50;
  startLEDs();
  delay(5000);
  stopLEDs();

  pwr_850 = 30;
  pwr_660 = 30;
  digitalWrite(15, 0);
  led_hz = 2;   // Strobe cycles per second
  led_duty = 50;
  startLEDs();
  delay(5000);
  stopLEDs();

  pwr_850 = 30;
  pwr_660 = 30;
  digitalWrite(15, 1);
  led_hz = 5;   // Strobe cycles per second
  led_duty = 50;
  startLEDs();
  delay(5000);
  stopLEDs();

  pwr_850 = 30;
  pwr_660 = 30;
  digitalWrite(15, 0);
  led_hz = 10;   // Strobe cycles per second
  led_duty = 50;
  startLEDs();
  delay(5000);
  stopLEDs();
}

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


text:
Why is this simple sketch not working? I want step thru 3 variables on alternate button presses. Keeps getting stuck of 1st one. Here is the code
I know that I am missing something basic but cannot find the problem. The button works correctly. The board is Nano connect. Monitor readout is stuck on first line although obviously the whole thing is repeating as it should.
int var = 0;
int sens = 2;
int grn = 0;
int red = 0;
int blu = 0;

void setup() {
  Serial.begin(9600);
  pinMode(3, OUTPUT);
  pinMode(5, INPUT);   //switch pulled low
  pinMode(12, OUTPUT); // N/A
  pinMode(11, OUTPUT); // N/A
  pinMode(10, OUTPUT); // N/A
  digitalWrite(3, HIGH); //supply to switch
  grn = HIGH;
}

void loop() {
  int button = 0;
  button = digitalRead(5);
  // Serial.println(button);

  if (button == HIGH && blu == HIGH) {
    blu = HIGH;
  }
  if (blu == HIGH) {
    blu = LOW;
    red = HIGH;
  }
  if (button == HIGH && red == HIGH) {
    red = HIGH;
  }
  if (red == HIGH) {
    red = LOW;
    grn = HIGH;
  }
  if (button == HIGH && grn == HIGH) {
    grn = HIGH;
  }
  if (grn == HIGH) {
    grn = LOW;
    blu = HIGH;
  }

  if (blu == HIGH) {
    Serial.println("blu");
  }
  if (red == HIGH) {
    Serial.println("red");
  }
  if (grn == HIGH) {
    Serial.println("grn");
  }
}

You could also consider using the else if construct instead of just if to prevent the simpler conditions overriding the previous conditions. if (blu == HIGH) overrides if (button == HIGH && blu == HIGH) . Another approach, since you are dealing with only 4 boolean variables button, blue, red and grn is to have 16 conditional expression listing each possible combination of the those variable values and the action to be taken.

your sketch is unnecessarily complicated ... you are keeping track of three flags, red, blue, grn ... all you need is one, a counter that counts 0 to 2 and repeats ... then light an LED in response to the value of the counter

The reason is: Your loop logic is such that the conditions if (<color> == HIGH) is always true. Before the serial output the variables hold these values:

blu is HIGH;
red is LOW;
grn is LOW.

This is additionally independent of the level at button.
If all variables were LOW, there is no path to set one HIGH. Since you start with grn set to HIGH, this combination cannot be reached.
The following table shows this.

Source line
Remark
blu
red
grn

repeated from former loop
HIGH
LOW
LOW

  if (button == HIGH && blu == HIGH) {
does not matter
:
:
:

    blu = HIGH;
executed or not
already HIGH
:
:

  }
:
:
:
:

  if (blu == HIGH) {
is true
:
:
:

    blu = LOW;
executed
set LOW
:
:

    red = HIGH;
executed
:
set HIGH
:

  }
:
:
:
:

  if (button == HIGH && red == HIGH) {
does not matter
:
:
:

    red = HIGH;
executed or not
:
already HIGH
:

  }
:
:
:
:

  if (red == HIGH) {
is true
:
:
:

    red = LOW;
executed
:
set LOW
:

    grn = HIGH;
executed
:
:
set HIGH

  }
:
:
:
:

  if (button == HIGH && grn == HIGH) {
does not matter
:
:
:

    grn = HIGH;
executed or not
:
:
already HIGH

  }
:
:
:
:

  if (grn == HIGH) {
is true
:
:
:

    grn = LOW;
executed
:
:
set LOW

    blu = HIGH;
executed
set HIGH
:
:

  }
:
:
:
:

When investigating issues like this, take pen and paper and play the role of the Arduino. Alternatively you can insert a lot of Serial.print() to follow the values of the variables.


text:
How to declare PB3 reset pin of ATtiny44 in program (using arduino IDE platform)
As follow-up of my former question:
Hi, I want to know how I can access PB3 reset pin of ATtiny44 IC. I ran out of pins so I am using it as I/O pin, but I am unable to declare it in the code.

This picture above says that PB3 is pin 11. But if I declare it as pin 11, the reset pin does not function at all.
// in setup():
    DDRB |= (uint8_t)(1U << 3);

// in loop():
    PORTB |= (uint8_t)(1U << 3);    // set PB3 to "high"
    PORTB &= ~((uint8_t)(1U << 3)); // set PB3 to "low"

This code works with only direct declaration.
In my code I just need to add pin number to the command like #define CSN 2.

EDIT
#include <avr/io.h>

const int led = 0;

#define led1 11

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(led, OUTPUT);

  pinMode(led1, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
    digitalWrite(led, HIGH);
    digitalWrite(led1, HIGH);

    delay(1000);                       // wait for a second

    digitalWrite(led1, LOW);

    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);                       // wait for a second
}

This is the code that does not work (led1 is reset pin as GPIO). Even if I change the led1 declaration to PB3 of PCINT11, it still does not work.

Show a complete compilable/testable example that demonstrates it affecting the pin using GPIO register manipulation and not affecting it using attinycore's already provided digital pin 11.

@timemage You can check the edit above

I see it. That does not look like what I described. Basically I'm looking for an excuse to actually test this. I fully expect if I take the time to dig out my high voltage programmer, and wire it so I can recover from RSTDISBL and I do my own test I will find that digital pin 11 with the correct layout in attinycore will work just fine and the problem is not really as written. If I put in that sort of effort, I'll know I'm not imagining things but I still won't be able to write an answer that I think will solve this for you. It is already documented.

excuse? i performed my test but the led on the reset remains full OFF and as per the code it should blink whereas, the second led connected to pin13 properly blinks. That is my issue. i have added my fusebit config for your reference.

I am using damellis library to use arduino as ISP

By excuse if you mean, the reason behind using reset. The reason is that I ran out of pins and in order to complete the project I need one more GPIO pin and using reset as GPIO is the only solution I can see.

That may be part of your problem if it leads to incompatible compilation of the sketch. I don't know why you're doing that, attinycore provides for programming via arduino as isp. By "excuse" I mean that I don't want to spend a few hours locating everything just to show that everything behaves exactly as I expected and "the problem is not really as written", like for example what you just said about trying to use two board support packages in a way that may easily screw things up. That was not in the question.

I think there is some misunderstanding. I am using just ATtiny44, for programming I am using HVP because I have to disable the reset pin. To write the code I use Arduino platform and I am at the final stage of my program.

That is in line with my understanding. If information shows in the question that makes me feel like I can replicate your test and I'm not dead-certain that it won't just work for me, I'll take the time recreate the problem here.

@timemage Ok, so you think that declaring it as pin11 would work

I have formatted you question a second time, please do not overwrite it again. ;-) -- If the pin works by direct access, as I showed you in the other question, and does not work with the pin number 11, this pin number or the board selection in the IDE do not match. Which board did you select in the IDE? -- Oh, BTW, this answer backs up my assumption that the pin PB3 does no have a pin number.

@thebusybee, notice they've been trying to use the damellis board package for their programmer definition for some inexplicable reason instead of the attinycore one. i wouldn't be surprised if it's recompiling under a damellis core prior to upload because they've selected that board package to use its version of arduinoisp.ino programmers.txt entry. I fully expect that if set up attinycore with an attinyX4 and use its own programmers.txt entry for arduinoisp.ino, disable reset, and use pin 11 it'll just work fine. so i've been trying to get them to update their question.

@thebusybee and timemage Hi, just an update, i have resolved my issue. I installed spencekonde attiny Core and it worked for me now i can assign reset pin as 11, use HVP to disable reset. Thank you.

Great news! Now, to help future visitors (including yourself after some weeks :-P) please write an actual answer and mark it as "accepted".

@thebusybee Okay, that issue has been resolved and i have written answer as well, i will create another post because i have some other issue now with the same project.

@thebusybee https://arduino.stackexchange.com/questions/92329/reading-constant-battery-voltage-and-using-the-obtained-value-in-sensor-formula  Could you please check this

i resolved my issue by installing spenceKonde ATtinyCore library, The RESET pin is pin 11 of attiny44 IC and in order to access it inside the code we need attinyCore library not Damellis( damellis does not have RESET programming access).


text:
How to use pyserial to write two separate message?
I'm using pyserial to communicate with my arduino. I set up the connection and everything works fine. Now I have these two writing commands:
pyserial.write("conn".encode())
pyserial.write("mod1".encode())

On my arduino:
while (!Serial.available());
String s = Serial.readString();
if (s=="conn") do...;
if (s=="mod1") do...;

The problem is that none of the if statements are true because s becomes "connmod1", because the messages are sent almost at the same time I guess. I know I could use some delimiter to split the string, but I would like to know what the convenient solution might be?

you already answered your own question I know i could use some delimiter

readString() waits for the next character until timeout. default timeout is 1 second. you can set the timeout with Serial.setTimeout(millis). https://www.arduino.cc/reference/en/language/functions/communication/serial/readstring/

If you want a quick, cheap, and easy solution, you could just use sleep() in your Python script to put a delay between the commands. This obviously isn't a perfect solution, but it's not difficult to implement.
Or, like you said, you could use a delimiter. It's not as easy to implement, but it'll work better.
If you go the delimiter rout, you'll probably need to use Serial.read() instead of Serial.readString(). That way you can examine characters individually as they come in. You can store your characters in a String or char array until you detect your delimiter and then execute your command.
Hope that helps!


text:
how to change output PWM based on analog input
I want to give different PWM (D11) signals based on how much voltage is input (A7). How can I change PWM for different analog values?
#include <LiquidCrystal.h>
#include <ezButton.h>

ezButton button(7);
int count;
int count1;

const float Pin0=A0;
const float Pin1=A1;
const float Pin2=A2;
const float Pin7=A7;

float valueA;
float valueB;
float valueC;
int valueD;

const float rs = 1, en = 2, d4 = 3, d5 = 4, d6 = 5, d7 = 6;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  TCCR2B = 0b00000001; // x1
  TCCR2A = 0b00000011; // fast pwm
  pinMode(11, OUTPUT);
  pinMode(9, OUTPUT);
  button.setDebounceTime(5); // set debounce time to 50 milliseconds
  button.setCountMode(COUNT_FALLING);
  lcd.begin(16, 1);
  pinMode(Pin0, INPUT);
  pinMode(Pin1, INPUT);
  pinMode(Pin2, INPUT);
  pinMode(Pin7, INPUT);
}

void loop() {
  float a;
  float b;
  float c;

  valueD = analogRead(Pin7);

  digitalWrite(9, HIGH);
  digitalWrite(9, LOW);
  valueA = analogRead(Pin0);
  digitalWrite(9, HIGH);

  a = valueA * 5 / 1023;
  b = valueB * 5 / 1023 * 1.91 - a;
  c = valueC * 5 / 1023 * 0.182;

  valueB = analogRead(Pin1);
  valueC = analogRead(Pin2);

  button.loop();
  int count = button.getCount();
  count1 = constrain(count, 0, 4);
  if (count1 == 0) {
    lcd.print("Bal-Chg");
  }
  if (count1 == 1) {
    lcd.print("V1: ");
    lcd.print(a);
    lcd.print("V");
  }
  if (count1 == 2) {
    lcd.print("V2: ");
    lcd.print(b);
    lcd.print("V");
  }
  if (count1 == 3) {
    lcd.print("I:");
    lcd.print(c);
    lcd.print("A");
  }
  if (count1 == 4) {
    button.resetCount();
  }

  delay(500);
  lcd.clear();
}

https://www.gammon.com.au/forum/?id=11504&reply=6#reply6 is an example of using a potentiometer (on an analog input) to control the duty cycle of hardware timer. This is example is especially useful if you don't want to work with standard frequencies that analogWrite() restricts you to.

Are you using an Arduino UNO or some other processor?

The map() function can help. Supply it the minimum and maximum possible values of the A/D output, and the minimum and maximum inputs to the PWM. (This as assuming you expect the full range of inputs and want the full range of outputs.) It will do the calculations for you. You'll have to code reading the A/D and writing the PWM.


text:
MQ7.h: No such file or directory
Using ESP32 I'm making air pollution quality meter. For that I need MQ7.h library which is of version 1.0.4 MQUnified sensor library, which supports all sensors.
I am using MQ7 carbon monoxide sensor... but that shows error no such file MQ7....
The link for library I will share with you ..github.com/miguel5612/MQSensorsLib.... This link has "mqunified" for all sensors. I just need it to support my code which have written for MQ7:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ArduinoJson.h>
#include <PubSubClient.h>
#include <WiFi.h>
#include <math.h>
#include "MQ7.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI   13
#define OLED_CLK   14
#define OLED_DC    12
#define OLED_CS    15
#define OLED_RESET 27
#define WIFI_ssid "rtpl1"
#define WIFI_PASSWORD "startupindia007"
#define TOKEN "yXrewssGkRD8jgjPqW70"
#define MQ135 35
#define MQ135_DEFAULTPPM 392 //default ppm of CO2 for calibration
#define MQ135_DEFAULTRO 41763 //default Ro for MQ135_DEFAULTPPM ppm of CO2
#define MQ135_SCALINGFACTOR 116.6020682 //CO2 gas value
#define MQ135_EXPONENT -2.769034857 //CO2 gas value
#define MQ135_MAXRSRO 2.428 //for CO2
#define MQ135_MINRSRO 0.358 //for CO2
#define MQ135_PULLDOWNRES 5000
#define ADC_REFRES 1024
uint16_t mq135_a ;
MQ7 mq7(34,3.3);
char thingsboardServer[]="demo.thingsboard.io";
String temperature, humidity, line, dust, mq135, mq7_CO;
float pm;
String latitude = "18.5457" , longitude = "73.7847";
int measurePin =  36;
int ledPower = 3;
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
WiFiClient wifiClient;
// Initialize DHT sensor.
PubSubClient client(wifiClient);
int status = WL_IDLE_STATUS;
unsigned long lastSend;
StaticJsonDocument<200> jsonBuffer;

void getPPMData()
{
  mq135_a = analogRead(MQ135);
  long res = adc_getresistence(mq135_a, MQ135_PULLDOWNRES);
  long mq135_ro = mq135_getro(res, MQ135_DEFAULTPPM);
  double d = mq135_getppm(res, MQ135_DEFAULTRO);
  int accStatus=0;
  int reading=analogRead(32);
  Serial.println(reading);
  float t ;
  t=((reading*3.3*10)/4095);
  digitalWrite(ledPower,LOW); // power on the LED
  delayMicroseconds(samplingTime);
  voMeasured = analogRead(measurePin); // read the dust value
  delayMicroseconds(deltaTime);
  digitalWrite(ledPower,HIGH); // turn the LED off
  delayMicroseconds(sleepTime);
  // 0 - 3.3V mapped to 0 - 1023 integer values
  // recover voltage
  calcVoltage = voMeasured * (3.3 / 1024);
  dustDensity = 241.708 * calcVoltage - 0.1;
  dust = String(dustDensity);
  temperature = String(t);
  mq135 = String(d);
  mq7_CO = String(mq7.getPPM());
  display.clearDisplay();
  display.setTextSize(1); // Draw 2X-scale text
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print(F("CO2 PPM - "));
  display.println(mq135);
  display.print(F("CO PPM - "));
  display.println(mq7_CO);
  display.print(F("PM2.5 PPM - "));
  display.println(dust);
  display.print(F("TEMP - "));
  display.println(temperature);
  // Prepare a JSON payload string
  String payload1 = "{";
  payload1 += "\"temperature\":"; payload1 += temperature; payload1 += ",";
  payload1 += "\"humidity\":"; payload1 += humidity; payload1 += ",";
  payload1 += "\"CO2 PPM\":"; payload1+= mq135; payload1 += ",";
  payload1 += "\"CO PPM\":"; payload1 += mq7_CO; payload1 += ",";
  payload1 += "\"PM2.5 PPM\":"; payload1 += dust;
  payload1 += "}";
  // Send payload
  char telemetry1[100];
  payload1.toCharArray( telemetry1, 100);
  client.publish( "v1/devices/me/telemetry", telemetry1 );
  String payload2 = "{";
  payload2 += "\"latitude\":"; payload2 += latitude; payload2 += ",";
  payload2 += "\"longitude\":"; payload2 += longitude;
  payload2 += "}";
  char telemetry2[100];
  payload2.toCharArray( telemetry2, 100);
  client.publish( "v1/devices/me/telemetry", telemetry2 );
  display.print(F("Payload Sent to Thingsbaord"));
  display.display();
  Serial.println( telemetry1 );
}

void InitWiFi()
{
  Serial.println("Connecting to AP ...");
  WiFi.begin(WIFI_ssid, WIFI_PASSWORD);
  display.clearDisplay();
  display.setTextSize(1); // Draw 2X-scale text
  display.setTextColor(WHITE);
  display.setCursor(10, 0);
  display.println(F("Connecting to AP"));
  // attempt to connect to WiFi network
  while (WiFi.status() != WL_CONNECTED) {
    display.print(F("."));
    display.display();      // Show initial text
    delay(500);
    Serial.print(".");
  }
  display.clearDisplay();
  display.setTextSize(1); // Draw 2X-scale text
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println(F("Connected to AP"));
  Serial.println("Connected to AP");
}

void reconnect() {
  // Loop until we're reconnected
  display.clearDisplay();
  while (!client.connected()) {
    status = WiFi.status();
    if ( status != WL_CONNECTED) {
      WiFi.begin(WIFI_ssid, WIFI_PASSWORD);
      display.setTextSize(1); // Draw 2X-scale text
      display.setTextColor(WHITE);
      display.setCursor(0, 0);
      display.println(F("Connecting to AP"));
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
        display.print(F("."));
        display.display();
      }
      display.clearDisplay();
      display.setTextSize(1); // Draw 2X-scale text
      display.setTextColor(WHITE);
      display.setCursor(0, 0);
      Serial.println("Connected to AP");
      display.println(F("Connected to AP"));
      display.display();
    }
    display.clearDisplay();
    display.setTextSize(1); // Draw 2X-scale text
    display.setTextColor(WHITE);
    display.setCursor(0, 0);
    Serial.print("Connecting to ThingsBoard node ...");
    display.print(F("Connecting to ThingsBoard node ..."));
    // Attempt to connect (clientId, username, password)
    if ( client.connect("ESP32 Demo Device", TOKEN, NULL) ) {
      Serial.println( "[DONE]" );
      display.println(F("Connected to Thingsboard node"));
      display.display();
    }
    else {
      Serial.print( "[FAILED] [ rc = " );
      display.print(F("Connection failed - "));
      display.println(client.state());
      Serial.print( client.state() );
      Serial.println( " : retrying in 5 seconds]" );
      display.print(F(": retrying in 5 seconds"));
      display.display();
      // Wait 5 seconds before retrying
      delay( 5000 ):
    }
  }
}

/*
 * get the calibrated ro based upon read resistance, and a know ppm
 */
long mq135_getro(long resvalue, double ppm) {
  return (long)(resvalue * exp( log(MQ135_SCALINGFACTOR/ppm) / MQ135_EXPONENT ));
}

/*
 * get the ppm concentration
 */
double mq135_getppm(long resvalue, long ro) {
  double ret = 0;
  double validinterval = 0;
  validinterval = resvalue/(double)ro;
  if(validinterval<MQ135_MAXRSRO && validinterval>MQ135_MINRSRO) {
    ret = (double)MQ135_SCALINGFACTOR * pow( ((double)resvalue/ro), MQ135_EXPONENT);
  }
  return ret;
}

/*
 * convert an adc value to a resistence value
 */
long adc_getresistence(uint16_t adcread, uint16_t adcbalanceresistor)
{
  if(adcread == 0){
    return 0;
  }
  else{
    return (long)((long)(ADC_REFRES*(long)adcbalanceresistor)/adcread-(long)adcbalanceresistor);
  }
}

void setup() {
  Serial.begin(115200);
  if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
  Serial1.begin(9600, SERIAL_8N1, rxPin, txPin);  //UART for pulse sensor Interfacing with Arduino
  //dht.begin();
  delay(10);
  InitWiFi();
  client.setServer( thingsboardServer, 1883 );
  display.println(F(thingsboardServer));
  display.display();
  delay(100);
  // Serial.println(thingsboardServer);
  lastSend = 0;
  pinMode(MQ135, INPUT);
  analogReadResolution(10);
  pinMode(ledPower,OUTPUT);
  pinMode(measurePin,INPUT);
}

void loop() {
  if ( !client.connected() ) {
    reconnect();
  }
  if ( millis() - lastSend > 500 ) { // Update and send only after 1 seconds
    getPPMData();
    lastSend = millis();
  }
  client.loop();
}

please describe what you are trying to do ... also add the complete error message

Using ESP32  I m making air pollution quality meter. For that I need MQ7.h library which is of version 1.0.4 MQUnified sensor library. which supports all sensors. I am using MQ7 carbon monoxide sensor...but that shows error no such file MQ7....the link for library I will share with you ..https://github.com/miguel5612/MQSensorsLib....this link has mqunified fr all sensors ..I just need it to support my code which have written for MQ7

Please don't put additional information in a comment. You can [edit] your question, for example by the link on the left below your question -- I did this for you just now. And, please, take the [tour] and learn [ask].

Did you install the library? If yes, how?

yes i installed in arduino IDE


text:
Import into Arduino a vintage data bus from TMS1000
For experimentation I want to import or receive into Arduino the output data from a TMS1000 (1980s) data bus.  For model train controller Hornby Zero1, and the bus sends data to receivers, for loco number, speed, direction etc. I have all the data structure etc) Is it feasible  to import to Arduino, and export from the same Arduino back to the original bus.    Just to see it working, and then later experiment with the data in the Arduino.
What libraries would be best ?
Thanks
Charles Harris

it is feasible ... nothing else can be said without any information .... please remove the can-bus and modbus tags

The Arduino does not have a bus but you can simulate it with some latches and data buffers. The TMS1000 is a family of microcontrollers introduced by Texas Instruments in 1974. It combined a 4-bit central processor unit, read-only memory (ROM), read/write memory (RAM), and input/output (I/O) lines as a complete “computer on a chip” You will have to give a lot more information if you want a usable answer.

You're not going to find any pre-built libraries for this task which is somewhat unusual but not at all impossible.
Basically all you need to do is to connect the TMS1000 address/data and strobe lines to Arduino inputs and write yourself some relatively simple code to detect the various TMS1000 bus states and capture them when they happen.  In order to detect specific events as you have mentioned you will need to know more about the TMS1000 software that's running and what I/O devices that it's selecting.  But again, that's all pretty straightforward.
Keep in mind, however, that you are going to have to perform level shifting on ALL the inputs from the TMS1000.  This old TI chip was implemented using a PMOS (i.e. a predecessor to both NMOS and CMOS) and uses a NEGATIVE power supply instead of the more common today POSITIVE supply.
So rather than being powered by a +5V supply the way an Arduino is, the TMS1000 is powered by a -15V supply.  In this case ground is still at 0V but Vdd is -15V.  That means the I/O signals adhere to a different scheme as noted in the datasheet:

You can view the datasheet yourself at:
TMS1000 Datasheet
But what this means is that a LOW (i.e. Vil) is at -15V and a HIGH (i.e. Vih) is at 0V.  You will need to translate these voltages so that you don't damage either the TMS1000 or the Arduino and you get the correct levels on the pins that you are watching.
The TMS1000 datasheet has some suggested circuits for interfacing to 74LSxx series parts (i.e. 5V logic) which will probably get you started.  Note that the simplest method involves running the 5V logic with its VDD at 0V and it's "ground" at -5V.  While this might seem odd, the Arduino will not know the difference as voltage is always relative.

voltage is relative. should be able to come up with a setup where -15V for Hornby is GND for arduino if you really wanted to.


text:
Trouble Programming ATTINY1616 with Arduino Nano via UPDI: No Communication
I'm trying to program a board I designed with an ATTINY1616. The schematic is shown in the photo. I'm trying to connect an Arduino Nano. +5V and GND are shared, while the UPDI pin is connected to the Nano's D6 with a 470Ω resistor in series and a 10kΩ pull-up. Is there any mistake? I can't establish communication. I have, of course, flashed jtag2updi from https://github.com/SpenceKonde/jtag2updi.

Other than showing us the schematic, there is not much information you tell us. What "no communication" means? What is your configuration setup on Arduino IDE Tools -> Programmer?

You could also consider the following statement from the SpenceKonde link you have quoted above as a warning and look at the alternatives: "This tool is not recommended anymore". I use a simple USB/UART adaptor, a diode and a resistor for UPDI programming of the new series AVR chips.

State also what connections you make between your Nano and header H3 on your ATtiny1616 board when attempting a program upload.

Sometimes loose connections or poor contact can prevent proper communication.
Check if the 470Ω resistor is placed between D6 of the Nano and the UPDI pin on the ATTINY1616, with no breaks in the line. Since, it's a custom-made board, there may be some manufacturing errors. Please check your PCB thoroughly with a multimeter. The following contents may help in this regard:
https://www.youtube.com/watch?v=OxlqhZVOdNI
https://www.pcbway.com/blog/2/Modern_PCB_testing_strategies.html
Also, check your power supply. If the ATTINY1616 isn't getting enough power, programming might fail. If possible, check the voltage at the ATTINY1616 during programming.


text:
How to manage button state
Extreme Newbie here ...I am using an Arduino Uno and a PCA9685 16 Ch. Driver board to control servos using a push button and LED feedback.  When I pust the button, the servo move but when I release the button, the servo move back to it original position.  What I would like to have happen is that when I push the button once, the servo moves and holds its position.  When I push the button again, return to its starting position.  Thanks in advance for the assistance.
Here is the sketch:
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

int buttonPin0 = 2;   // Can add as many buttons as needed
int ledPin0C = 3;     // C designates Closed position of turnout
int ledPin0T = 4;     // T designates Thrown position of turnout
int buttonState0 = 0;

int buttonPin1 = 5;
int ledPin1C = 6;
int ledPin1T = 7;
int buttonState1 = 0;

void setup() {
    Serial.begin(9600);
    Serial.println("pca9685_TurnoutFinal!");
    pwm.begin();
    pwm.setPWMFreq(60);
    delay(30);

    pinMode(ledPin0C, OUTPUT);
    pinMode(ledPin0T, OUTPUT);
    pinMode(buttonPin0, INPUT);
    pinMode(ledPin1C, OUTPUT);
    pinMode(ledPin1T, OUTPUT);
    pinMode(buttonPin1, INPUT);
}

void loop() {
    ///////////
    buttonState0 = digitalRead(buttonPin0);
    if (buttonState0 == HIGH) {
        pwm.setPWM(0, 0, 370);
        digitalWrite(ledPin0T, LOW);
        digitalWrite(ledPin0C, HIGH);
    }
    else {
        pwm.setPWM(0, 0, 285);
        digitalWrite(ledPin0C, LOW);
        digitalWrite(ledPin0T, HIGH);
    }
    //////////
    buttonState1 = digitalRead(buttonPin1);
    if (buttonState1 == HIGH) {
        pwm.setPWM(1, 0, 370);
        digitalWrite(ledPin1T, LOW);
        digitalWrite(ledPin1C, HIGH);
    }
    else  {
        pwm.setPWM(1, 0, 285);
        digitalWrite(ledPin1C, LOW);
        digitalWrite(ledPin1T, HIGH);
    }
    //////////
}

The code in loop is always running so when you release the button, the code sees this as digitalRead(btn) = HIGH.
You need a state variable to know where the motor is currently.  Something like this:
boolean state = false;
int oldButton = HIGH;

void loop() {
    delay(20); // enough to debounce very most buttons

    int newButton = digitalRead(buttonPin0);
    if (oldButton == HIGH && newButton == LOW) { // only when button changes from "released" to "pressed"
        state = !state;

        // tell the servo where to go
        if (state) {
            pwm.setPWM(0, 0, 370);
        } else {
            pwm.setPWM(0, 0, 285);
        }
    }
    oldButton = newButton;
}

Thank you ... I will try to figure out where it goes.

Also take button bouncing into account.

Michel would it be possible for you to elaborate on button bouncing?

Disregard Michel ... I did a little reading and now know what it is ... not sure if it will affect my project but again thank you for making me aware of it.


text:
Switch Case Return , Return not printing
I am trying to get the value of a key pressed and set it to return a value to use in a loop.  In the code below the Print(t) does not show anything
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char hexaKeys[ROWS][COLS] = {
    {'1', '2', '3', 'A'},
    {'4', '5', '6', 'B'},
    {'7', '8', '9', 'C'},
    {'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[ROWS] = {5, 4, 3, 2};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys),rowPins,colPins,ROWS,COLS;

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

void loop()
{
    int t;
    switch (customKeypad.getKey())
    {
    case 'A':
        t = 8;
        break;
    case '2':
        t = 9;
        break;
    }
    return t;
    Serial.print(t);
}

Please show your wiring

You misunderstand the use of return.  The loop function is declared void.  That means it doesn't return anything.  If you simply remove that return statement completely then your code will do what you want.
The return stops the loop.  It throws away the value since the loop is defined as returning void, and code execution never reaches the print statement.  Writing anything in a function after a return statement is useless.


text:
Counter on my coin acceptor goes up without a coin input, any advice?
I'm working on a project that makes use of a CH926 coin acceptor. The problem we're having is that when I read the serial monitor, the coin value is continuously going up and adding credits when it's supposed to remain at 0 until a coin Is fed into the acceptor.
We've tried a different coin acceptor, different codes, arduinos, wiring, resistors, breadboards, the lot. nothing seems to be solving this problem and we can't determine why, it had been working fine until we tried to tidy up our wiring and untangle it.
we're using a basic code that had worked fine up until we had the issue of the counter value no longer remaining at 0:
const int coinpin = 2;
const int ledpin = 3;
const int targetcents = 100;

// Variables
volatile int cents = 0;
int credits = 0;

// Setup
void setup() {

  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(coinpin), coinInterrupt, RISING);
  pinMode(ledpin, OUTPUT);

}

// Main loop
void loop() {

  // If we've hit our target amount of coins, increment our credits and reset the cents counter
  if (cents >= targetcents) {
    credits = credits + 1;
    cents = cents - targetcents;
  }

  // If we haven't reached our target, keep waiting...
  else {
  }

  // Debugging zone
  Serial.print(cents);
  Serial.print(" cents toward current credit and ");
  Serial.print(credits);
  Serial.println(" credit(s) earned so far.");
  delay(1000);

  // Turn off LED
  digitalWrite(ledpin, LOW);

  // Now, write your own cool code here that triggers an event when the player has credits!
  if (credits > 0) {
    // Play music?
    // Spin up a motor?
    // Start a game?
    // It's up to you!
  }

}

// Interrupt
void coinInterrupt(){

  // Each time a pulse is sent from the coin acceptor, interrupt main loop to add 1 cent and flip on the LED
  cents = cents + 1;
  digitalWrite(ledpin, HIGH);

}

any advice on what may be causing this problem?
cheers

Sounds like a floating input. Check your pullup / pulldown resistor on coinpin.

In addition to what @Majenko said, I have the following idea: Since the Sensor is powered by 12 V I guess you power it externally. Have the external power and the Arduino a common ground connection? I.e. did you connect the GND of the external power and a GND Pin of the Arduino.  Perhaps you did it in your first setup but forgot it after rewiring.

if the coin acceptor worked until you tidied up the wiring, then why are you posting code? ... why did you say nothing about the wiring?

"...it had been working fine until we tried to tidy up our wiring and untangle it." Wait, what? Your hardware/software system was working fine until you made a hardware change (trying to tidy up the wiring) and now it isn't working, so you decide it must be the software? Why does that make any sense? If it worked fine until you made a hardware change, shouldn't you focus on hardware problems? You almost certainly messed up some of the wiring. Focus on that.

I'm also complicated by that. The advice I saw here was to connect a COIN wire also against an electric "R" 10K and connect  to the second hole on the left in the Arduino "IOREF" now it works.


text:
Multitasking with Arduino?
I am making a Christmas Tree with Arduino. I found a 12 led chaser code on internet so I made 12 rows of leds and hook them up to my Arduino pro mini.
They are working just fine.
However, I also want to add music with piezo buzzer while running the LEDs. Is that possible somehow or should I use another microcontroller for piezo? I also used pin 10 for piezo buzzer and used pin 14(a0) for led assigned for pin 10 previously..
Here are the codes:
12 led chaser
#define t   30
#define t1  20
#define t2  100
#define t3  50

void setup() {
  // set up pins 2 to 13 as outputs
  for (int i = 2; i <= 13; i++) {
    pinMode(i, OUTPUT);
  }
}
/////////////////////////////////////////////////////////////////////////////////Effect 1
void loop(){

effect_1();
effect_1();

 effect_2();
 effect_2();

 effect_3();
 effect_3();

 effect_4();
 effect_4();

 effect_5();
 effect_5();

 effect_6();
 effect_6();

 effect_7();
 effect_7();
  }
//left to right and right to left
void effect_1()
{
for(int i=2; i<14; i++){
digitalWrite(i, HIGH);
delay(t1);
digitalWrite(i+1, HIGH);
delay(t1);
digitalWrite(i+2, HIGH);
delay(t1);
digitalWrite(i, LOW);
delay(t1);
digitalWrite(i+1, LOW);
delay(t1);
}
for(int i=13; i>1; i--){
digitalWrite(i, HIGH);
delay(t1);
digitalWrite(i-1, HIGH);
delay(t1);
digitalWrite(i-2, HIGH);
delay(t1);
digitalWrite(i, LOW);
delay(t1);
digitalWrite(i-1, LOW);
delay(t1);
}
}
/////////////////////////////////////////////////////////////////////////////////Effect 2
void effect_2()
{
int count = 13; // keeps track of second LED movement

  // move first LED from left to right and second from right to left
  for (int i = 2; i < 13; i++) {
    clear();
    digitalWrite(i, HIGH);      // chaser 1
    digitalWrite(count, HIGH); // chaser 2
    count--;
    // stop LEDs from appearing to stand still in the middle
    if (count != 7) {
      delay(t2);
    }
  }

  // move first LED from right to left and second LED from left to right
  for (int i = 13; i > 2; i--) {
    clear();
    digitalWrite(i, HIGH);      // chaser 1
    digitalWrite(count, HIGH); // chaser 2
    count++;
    // stop LEDs from appearing to stand still in the middle
    if (count != 8) {
      delay(t2);
    }
  }
}

////////////////////////////////////////////////////////////////////////////////Effect 3

void effect_3()
{
for(int i=2; i<14; i++){
  digitalWrite(i, HIGH);
  delay(t3);
}
for(int i=2; i<14; i++){
  digitalWrite(i, LOW);
  delay(t3);
}

for(int i = 14; i>=2; i--){
  digitalWrite(i, HIGH);
  delay(t3);
}
for(int i = 14; i>=2; i--){
  digitalWrite(i, LOW);
  delay(t3);
}
}
  ///////////////////////////////////////////////////////////////////////////Effect 4
void effect_4()
{
for(int j = 2; j <= 13; j++){
  digitalWrite(j, HIGH);
  delay(t2);
  j=j+1;
  }
for(int j = 2; j <= 13; j++){
  digitalWrite(j, LOW);
  delay(t2);
  }

  for(int k = 15; k > 2; k--){
  digitalWrite(k, HIGH);
  delay(t2);
  k=k-1;
  }
for(int k = 15; k > 2; k--){
  digitalWrite(k, LOW);
  delay(t2);
  }
}
//////////////////////////////////////////////////////////////////////////////Effect 5
  void effect_5()
{
 for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin, HIGH);
  delay(t1);
  digitalWrite(pin+1, LOW);
  delay(t1);
  }
  for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+1, HIGH);
  delay(t1);
  digitalWrite(pin+2, LOW);
  delay(t1);
  }
  for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+2, HIGH);
  delay(t1);
  digitalWrite(pin+3, LOW);
  delay(t1);
  }
  for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+3, HIGH);
  delay(t1);
  digitalWrite(pin+4, LOW);
  delay(t1);
  }
    for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+4, HIGH);
  delay(t1);
  digitalWrite(pin+5, LOW);
  delay(t1);
  }
  for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+5, HIGH);
  delay(t1);
  digitalWrite(pin+6, LOW);
  delay(t1);
  }
  for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+6, HIGH);
  delay(t1);
  digitalWrite(pin+7, LOW);
  delay(t1);
  }
   for(int pin = 13; pin >= 2; pin--)
  {
  digitalWrite(pin+7, HIGH);
  delay(t1);
  digitalWrite(pin+8, LOW);
  delay(t1);
  }
  for(int pin = 9; pin >= 2; pin--)
  {
  digitalWrite(pin+8, HIGH);
  delay(t1);
  digitalWrite(pin+9, LOW);
  delay(t1);
  }
    for(int pin = 9; pin >= 2; pin--)
  {
  digitalWrite(pin+9, HIGH);
  delay(t1);
  digitalWrite(pin+10, LOW);
  delay(t1);
  }
  for(int pin = 9; pin >= 2; pin--)
  {
  digitalWrite(pin+10, HIGH);
  delay(t1);
  digitalWrite(pin+11, LOW);
  delay(t1);
  }
  for(int pin = 14; pin >= 2; pin--)
  {
  digitalWrite(pin+11, HIGH);
  delay(t1);
  }
  for(int pin = 13; pin >= 2; pin--)
  {
    digitalWrite(pin, LOW);
  delay(t1);
    }
  }
  /////////////////////////////////////////////////////////////////////////////Effect 6
void effect_6()
{
for(int j=2; j<14; j++){
  digitalWrite(j, LOW);
  delay(t);
  digitalWrite(j, HIGH);
  delay(t);
  digitalWrite(j-2, LOW);
  delay(t);
  digitalWrite(j, HIGH);
}
for(int k = 15; k>2; k--){
  digitalWrite(k, LOW);
  delay(t);
  digitalWrite(k, HIGH);
  delay(t);
  digitalWrite(k+2, LOW);
  delay(t);
  digitalWrite(k, HIGH);
}
for(int k = 2; k<14; k++){
  digitalWrite(k, LOW);
  delay(t);
  digitalWrite(k, HIGH);
  delay(t);
  digitalWrite(k-2, LOW);
  delay(t);
  digitalWrite(k, HIGH);
}
for(int k = 15; k>2; k--){
  digitalWrite(k, LOW);
  delay(t);
  digitalWrite(k, HIGH);
  delay(t);
  digitalWrite(k+4, LOW);
  delay(t);
  digitalWrite(k, HIGH);
}
for(int k = 2; k<14; k++){
  digitalWrite(k, LOW);
  delay(t);
  digitalWrite(k, HIGH);
  delay(t);
  digitalWrite(k-4, LOW);
  delay(t);
  digitalWrite(k, HIGH);
}
}
///////////////////////////////////////////////////////////////////////////////////Effect 7
void effect_7()
{
for(int j=2; j<14; j++){
  digitalWrite(j, HIGH);
  delay(t);
  digitalWrite(j+2, LOW);
  delay(t);
}
for(int k = 15; k>2; k--){
  digitalWrite(k, HIGH);
  delay(t);
  digitalWrite(k+2, LOW);
  delay(t);
}
}

// function to switch all LEDs off
void clear(void)
{
  for (int i = 2; i <= 13; i++) {
    digitalWrite(i, LOW);
  }
}

Melody tone for buzzer:
/*
  We Wish You a Merry Christmas - Traditional Christmas song
  Connect a piezo buzzer or speaker to pin 11 or select a new pin.
  More songs available at https://github.com/robsoncouto/arduino-songs

                                              Robson Couto, 2019
*/
#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978
#define REST      0

// change this to make the song slower or faster
int tempo = 140;

// change this to whichever pin you want to use
int buzzer = 11;

// notes of the moledy followed by the duration.
// a 4 means a quarter note, 8 an eighteenth , 16 sixteenth, so on
// !!negative numbers are used to represent dotted notes,
// so -4 means a dotted quarter note, that is, a quarter plus an eighteenth!!
int melody[] = {

  // We Wish You a Merry Christmas
  // Score available at https://musescore.com/user/6208766/scores/1497501

  NOTE_C5,4, //1
  NOTE_F5,4, NOTE_F5,8, NOTE_G5,8, NOTE_F5,8, NOTE_E5,8,
  NOTE_D5,4, NOTE_D5,4, NOTE_D5,4,
  NOTE_G5,4, NOTE_G5,8, NOTE_A5,8, NOTE_G5,8, NOTE_F5,8,
  NOTE_E5,4, NOTE_C5,4, NOTE_C5,4,
  NOTE_A5,4, NOTE_A5,8, NOTE_AS5,8, NOTE_A5,8, NOTE_G5,8,
  NOTE_F5,4, NOTE_D5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,

  NOTE_F5,2, NOTE_C5,4, //8
  NOTE_F5,4, NOTE_F5,8, NOTE_G5,8, NOTE_F5,8, NOTE_E5,8,
  NOTE_D5,4, NOTE_D5,4, NOTE_D5,4,
  NOTE_G5,4, NOTE_G5,8, NOTE_A5,8, NOTE_G5,8, NOTE_F5,8,
  NOTE_E5,4, NOTE_C5,4, NOTE_C5,4,
  NOTE_A5,4, NOTE_A5,8, NOTE_AS5,8, NOTE_A5,8, NOTE_G5,8,
  NOTE_F5,4, NOTE_D5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,
  NOTE_F5,2, NOTE_C5,4,

  NOTE_F5,4, NOTE_F5,4, NOTE_F5,4,//17
  NOTE_E5,2, NOTE_E5,4,
  NOTE_F5,4, NOTE_E5,4, NOTE_D5,4,
  NOTE_C5,2, NOTE_A5,4,
  NOTE_AS5,4, NOTE_A5,4, NOTE_G5,4,
  NOTE_C6,4, NOTE_C5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,
  NOTE_F5,2, NOTE_C5,4,
  NOTE_F5,4, NOTE_F5,8, NOTE_G5,8, NOTE_F5,8, NOTE_E5,8,
  NOTE_D5,4, NOTE_D5,4, NOTE_D5,4,

  NOTE_G5,4, NOTE_G5,8, NOTE_A5,8, NOTE_G5,8, NOTE_F5,8, //27
  NOTE_E5,4, NOTE_C5,4, NOTE_C5,4,
  NOTE_A5,4, NOTE_A5,8, NOTE_AS5,8, NOTE_A5,8, NOTE_G5,8,
  NOTE_F5,4, NOTE_D5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,
  NOTE_F5,2, NOTE_C5,4,
  NOTE_F5,4, NOTE_F5,4, NOTE_F5,4,
  NOTE_E5,2, NOTE_E5,4,
  NOTE_F5,4, NOTE_E5,4, NOTE_D5,4,

  NOTE_C5,2, NOTE_A5,4,//36
  NOTE_AS5,4, NOTE_A5,4, NOTE_G5,4,
  NOTE_C6,4, NOTE_C5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,
  NOTE_F5,2, NOTE_C5,4,
  NOTE_F5,4, NOTE_F5,8, NOTE_G5,8, NOTE_F5,8, NOTE_E5,8,
  NOTE_D5,4, NOTE_D5,4, NOTE_D5,4,
  NOTE_G5,4, NOTE_G5,8, NOTE_A5,8, NOTE_G5,8, NOTE_F5,8,
  NOTE_E5,4, NOTE_C5,4, NOTE_C5,4,

  NOTE_A5,4, NOTE_A5,8, NOTE_AS5,8, NOTE_A5,8, NOTE_G5,8,//45
  NOTE_F5,4, NOTE_D5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,
  NOTE_F5,2, NOTE_C5,4,
  NOTE_F5,4, NOTE_F5,8, NOTE_G5,8, NOTE_F5,8, NOTE_E5,8,
  NOTE_D5,4, NOTE_D5,4, NOTE_D5,4,
  NOTE_G5,4, NOTE_G5,8, NOTE_A5,8, NOTE_G5,8, NOTE_F5,8,
  NOTE_E5,4, NOTE_C5,4, NOTE_C5,4,

  NOTE_A5,4, NOTE_A5,8, NOTE_AS5,8, NOTE_A5,8, NOTE_G5,8, //53
  NOTE_F5,4, NOTE_D5,4, NOTE_C5,8, NOTE_C5,8,
  NOTE_D5,4, NOTE_G5,4, NOTE_E5,4,
  NOTE_F5,2, REST,4
};

// sizeof gives the number of bytes, each int value is composed of two bytes (16 bits)
// there are two values per note (pitch and duration), so for each note there are four bytes
int notes = sizeof(melody) / sizeof(melody[0]) / 2;

// this calculates the duration of a whole note in ms
int wholenote = (60000 * 4) / tempo;

int divider = 0, noteDuration = 0;

void setup() {
  // iterate over the notes of the melody.
  // Remember, the array is twice the number of notes (notes + durations)
  for (int thisNote = 0; thisNote < notes * 2; thisNote = thisNote + 2) {

    // calculates the duration of each note
    divider = melody[thisNote + 1];
    if (divider > 0) {
      // regular note, just proceed
      noteDuration = (wholenote) / divider;
    } else if (divider < 0) {
      // dotted notes are represented with negative durations!!
      noteDuration = (wholenote) / abs(divider);
      noteDuration *= 1.5; // increases the duration in half for dotted notes
    }

    // we only play the note for 90% of the duration, leaving 10% as a pause
    tone(buzzer, melody[thisNote], noteDuration * 0.9);

    // Wait for the specief duration before playing the next note.
    delay(noteDuration);

    // stop the waveform generation before the next note.
    noTone(buzzer);
  }
}

void loop() {
  // no need to repeat the melody.
}

Yes, possible. Please look into non-blocking coding styles, like the one demonstrated in the BlinkWithoutDelay example, that comes with the Arduino IDE. It uses millis() as a time source, checking regularly, if it is time to do something, otherwise doing something else. There are tons of tutorials on the web about millis(). Please try them first

I think the method suggested by chrisl is probably the best for you to use here.  If you want to make a more-conventional multitasking system, you would set a timer such as TIMER2 to the minimum time slice, then at the start of your code (after setup) you'd have something like this:
ISR(TIMER2_COMPA_vect)
{
myIntHandler();
}
Here myIntHandler() does whatever needs to get done on each tick of TIMER2.  I use this general approach in my open-source DaqPort code to do simultaneous oscilloscope data acquisition and signal generation, while still handling serial commands in the background.
But that's probably overkill for your project. You can find out more about DaqPort at
https://www.daqarta.com/dw_rraa.htm

There are a couple of issues with this approach. The first is that it handles tasks in a “run-to-completion” mode, i.e. the tasks have to be defined as non-blocking functions that return after a single step, and keep static state in order to know what to do next time they are called. This makes the code not much simpler than using the typical millis() / Blink Without Delay technique (or any of the libraries built around this approach). Most people who ask for “multitasking” would expect to be able to delay() a task without blocking the others.

The second issue is that it makes the tasks run in interrupt context. There are a few traps you have to be careful about with code running in interrupt context, like increased latency to other interrupts, or data races. You most likely can handle them, but they can be a problem for beginners.


text:
Why does Arduino's servo library use pulse widths of 544 to 2400?
I learned in school that typical servos use a simple "PWM" system to control a servo. To do this, we would generate a 1000 µs pulse to put the servo at 0 degrees and a 2000 µs pulse to set it at 180 degrees. Simple basics, right?
I recently tried configuring my HS-311 with these values and I found the servo moving less than 90 degrees. I switched to the Servo.h library and it worked fine. I peeked at the Servo.h file and found the following:
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached

544? 2400? Where are these numbers coming from?
I looked at an old datasheet for this servo and found
OPERATING TRAVEL: 40°/ONE SIDE PULSE TRAVELING 400 usec
DIRECTION: CLOCK WISE/PULSE TRAVELING 1500 TO 1900 usec

A bit hard to tell what the numbers mean but they are definitely not 1000 to 2000!
Then I took a look at the specs on servocity.com and I see:
Max PWM Signal Range   575-2460 μsec.
This matches with the Servo.h source code!
What's going on here? Do manufacturers normally move outside of the 1000 µs to 2000 µs range? The values that I see far exceed what I'd think are acceptable tolerances. Please help me figure out where these numbers came from!

IIRC the first models of such servos were available in the 70s, about 50 years ago. At least one manufacturer used low pulses in contrast to other brands. The pulse width range was not standardized, too. So these variations can be historically necessary, or by the inevitable different quality of products, or simply trying to go to the limits. But since I'm no expert, this is just a comment, not an actual answer... You might want to start a research on the matter. ;-)

You may want to change this to "Why does Servo..." or something to that effect. Most of the people reading the current title will probably think that it's about analogWrite().

No it uses 2ms and 1ms and 1.5ms to go somewhere around 90 degrees
the 1000 and 2000 are micro seconds and not milliseconds

I've ran into this same issue. In the research I've done and the servo's I've worked with, the only way to know what the true max and min pulse widths are is to do some experimentation.
For example, servocity.com says this:

Different brands, and even different servos of the same brand, will have different maximum and minimums. Generally the minimum pulse will be about 1 ms wide and the maximum pulse will be 2 ms wide.

From my own testing with 3 or 4 different servo brands, 1ms-2ms is a "safe range". The servos will move within that range, but it likely won't be the full range that the servo is capable of. Start by looking at the data sheet, and then proceed to testing if you really need to eek out the most range.
For the HS-311, I believe the datasheet can be read as, "a change of 400usec corresponds to a rotation of 40°". If we assume the midpoint is 1500usec and the servo is capable of 180° rotation, then that would put the pulse width in the range of 600usec-2400usec which is close to the default range of the Servo.h library which is why it likely worked without needing to change the default max and min values.


text:
Interpreting Analog Output from Aalborg Mass Flow Meter GFM
I am attempting to connect this device to my computer via RS232.
I am debating the simplest way of going about this and was inquiring if my Uno R3 could come into use, turning the analog symbols of 0-5 Vdc and 4-20 mA from the GFM into an output in serial port over a COM port. I have an RS232 to USB and I am just now tasked with completing this.

0-5 Vdc and 4-20 mA ... it's 0-5 Vdc or 4-20 mA ... they both carry the same information

what is your question? ... please add a focused, answerable question to your post

@jsotola - Thanks for highlighting the cross-site multi-posting of this question on EE and here. The copy on EE has been closed, so this one can continue without duplication of effort across the sites.

Welcome to SE/Arduino! Please take the [tour] to learn how this site works. Then come back and [edit] your question to clarify. -- Why did you tag with modbus? -- Are you aware that your Arduino is able to measure voltages? What stops you from using analogRead()? -- If you have an attempt of a sketch, please add it. And why it does not work for you. Make sure to format it as source. See the help of the edit box for details.

Although it is common for mass flow meters to have a serial interface
(which could well be Modbus), this particular model has only analog
outputs. If you have an Uno at hand, your simplest option is to use it
for reading the 0–5V meter output, and send the data to the PC through
the Arduino's serial-over-USB connection.
Connect:

the meter's pin 3 (0 to 5 VDC common) to the Arduino's GND
the meter's pin 2 (0 to 5 VDC output indication) to the Arduino's A0
the Arduino's USB connector to your PC

You don't need the RS-232 to USB converter, as you will not be using
RS-232 at all.
The Arduino will simply read the analog voltage, optionally convert it
to flow units, and sent that through it's serial port:
const float flow_range = ...;          // the meter's full scale
const uint8_t input_pin = A0;          // analog input used
const uint32_t print_period_ms = 200;  // tune to taste

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

void loop() {
    float flow = analogRead(input_pin) * (flow_range / 1024);
    Serial.println(flow);
    delay(print_period_ms);
}


text:
RS-485 Serial communication problem with arduino
I use 485 modules to transmit data serially from one arduino uno to another uno.
If I connect the 2 arduino boards directly without using the rs485 module, the data is sent and received without a problem. But when using the rs485 module, the transmission stops.
Tx code:
void setup() {
    Serial.begin(9600);
}

void loop() {
    Serial.write(200);
    Serial.flush();
    delay(50);
}

Rx code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

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

void loop() {
    if (Serial.available()) {        // If data has come in from Master
        int reply= Serial.read();    // Read the byte
        delay(10);

        lcd.print(reply);
    }
}

I can't see what is the problem. I checked every thing wiring and the code is so simple. I'm just sending one number 200 and want to display it on the rx.
Please help. If anyone has an idea about this problem thanks any way.

your code is not really legible as presented ... please format it properly

What if you print to the serial terminal of the receiver, instead of trying to display it on the LCD?

In modbus there are two pins which are as DE and RE which you need to set and reset while transmitting the data. Also you can check Modbus this library it has some examples which could be useful to you also in arduino Uno don't use software serial for transmitting the data use the hardware serial only I will suggest implement your code on arduino Mega if you have any and then port the code for Uno. Just go through the library you will find some helpful examples and it will solve your issue

There is no mention of 'modbus' in the question, this is basic RS485. In two-wire, half duplex RS485, the 'transceiver' usually has a pin that should be pulled high or low. (Yes, modbus uses this as a physical/electrical layer in some cases)

I polished my glasses, I did not find the schematic and parts list. It appears you have to enable the transmitter and or receiver to make them work. DE and RE are pins on the Max RSS 485 driver chip and others. They will not transmit or receive if these are wrong. Many connect the DE and RE together to simplify the switching.  In your case you have to enable the transmitter on the transmitting Arduino and the Receive on the receiving Arduino. Do not enable the transmitter on the receive side as it wall cause bus contention and it will probably stop working. The receive can be enabled on the transmitter. This is done is some protocols to validate the message sent. Since you are only sending one way you can hardwire them to the correct logic level. Also you should terminate the buss, it may work without but best to add the resistors.


text:
Help with arduino code
Thank you for seeing my post.
I am trying to write a code that lets "A" displayed on row 1 and row 0 alternately on the LCD. starting from (0,1) then (1,0)  then (2,1), then (3,0) etc..
when it reaches the last point is becomes "B" and bouncing back the other way until reaching the starting point when it becomes "A" again and repeat again..
I wrote this code but I got stuck at the end, I don't know how to bounce it back:

// include the library code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);   // initialize the library with the numbers of the interface pins

int x = 0;
int y = 1;

void setup()
{
    lcd.begin(16, 2);
    lcd.clear();
}

void loop()
{
    {
        {
            while (x < 15)
            {
                lcd.setCursor(x, y);
                lcd.print("A");
                delay(250);

                lcd.clear();
                x = x + 1;
                lcd.setCursor(x, y - 1);
                lcd.print("A");
                delay(250);

                lcd.clear();
                x + x++;
            }
        }
        {
            while (x = 15)
                lcd.setCursor(15, 0);
            lcd.print("B");
            delay(2000);
            x--;
        }
    }
}

Learn to use a for loop. It's much easier. And don't confuse assignment (=) with comparison (==) operators.

To me it seems, as if you have no knowledge about C/C++. ( I might be wrong. ;-) )
If you plan to do more programming projects, I advice you to learn the basics of this programming language before proceed with the projects. It would be hard thinking about an algorithm, if you don't know the tools to implement it.
In case you just need this once for a (let's say arts project [or homework ;-)] ), I add some example code. At the moment I have no chance to test the code. So it's blind written, and there might be typos. In about 8 hours I will have access to a test setup then I'll correct it if necessary.
#include <LiquidCrystal.h>

// Here you setup your LCD display
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// you initialize the position where the next character
// will be displayed (0,1) (x,y)
int x = 0;
int y = 1;
// setup is only done once
void setup()
{
    // initialize the lcd lib to be used with a 16x2 LCD
    lcd.begin(16, 2);
    // erase all character from the display
    lcd.clear();
}

// the loop is executed again and again and ...
void loop()
{
    // move forward
    // as long as the position is less than 15
    // you allow x = 0, 1, 2, ... ,15 because
    // you increase two times in each loop step
    while (x < 15)
    {
        lcd.clear( );

        lcd.setCursor( x, y );
        lcd.print( "A" );
        delay( 250 );

        // step to the next position
        x = x + 1;
        // toggle y
        y = toggle( y );

        lcd.clear();
        lcd.setCursor( x, y );
        lcd.print( "A" );
        delay( 250 );

        // step to the next position
        x = x + 1;
        // toggle y
        y = toggle( y );
    }

    // now move backward
    // x is still 15 and you want to go backwards until x == 0
    while ( x > 0 )
    {
        lcd.clear( );

        lcd.setCursor( x, y );
        lcd.print( "B" );
        delay( 250 );

        // step to the next position
        x = x - 1;
        // toggle y
        y = toggle( y );

        lcd.clear( );
        lcd.setCursor( x, y );
        lcd.print( "B" );
        delay( 250 );

        // step to the next position
        x = x - 1;
        // toggle y
        y = toggle( y);
    }
}

// this is a subroutine that toggles y = 0 <-> 1
int toggle( int yval )
{
   // I use a ternary operator
   // in case y == 1, I return 0 and a 1 otherwise
   return ( yval == 1) ? 0 : 1;
}


text:
Nodemcu & GSM module & CLIP problem (CLIP line not always appears on the serial connection)
I'm working on phone-controlled car park gate. Trusted employees numbers are saved on SIM card/hard coded in program. So the idea is, if a trusted person calls  the "gate number" ; Nodemcu  will trigger a relay. The key issue is the "CLIP:"  line which is supposed to appear each time on the serial connection during incoming call. When it appears I can parse it in order to determine if the "source" number is "trusted". CLIP: line is the only one where the "source number" is visible. I've got the impression that the line sometimes appears and sometimes not. There is no rule , but usually it appears right after rebooting the controller . So now, I'm rebooting my Nodemcu every 10 minutes but even that doesn't guarantee success. Furthermore, the "RING line" appears on the serial connection always  during the incoming call (but in RING line there is no number)
I've already tested 2 GSM modules, based on SIM800L & A6 GSM/GPRS chips. The same problem.
I got stuck with and have no more ideas. Maybe someone here had the same problem? Thanks for any help.
PS
of course I send AT+CLIP=1 to the GSM module in setup function, and later in the main loop (just in case)
--------------- the most important piece of code below ----------
void loop() {

  while(mySerial.available()) {
    incomingByte = mySerial.read();
    inputString += incomingByte;
    //Serial.print(incomingByte);
  }

  if (inputString.indexOf("MYNUMBER") > 0){
    trustedisCalling();//this function does the rest and it's OK
  }
}

when I uncomment:
Serial.print(incomingByte);

Sometimes I can see the CLIP line on serial console but sometimes not. RING notification, which is subsequent to CLIP appears always during incoming call.

Can you show us the sketch you're using?

I put the most important part of code to the first post.


text:
Arduino-Controlled LED Matrix issues
I am making a 20 x 15 LED matrix, and am having some super annoying problems. I was hoping you all could help me find some answers.
It is very important to note that I am following BitLuni's video on this, following it using almost the same parts, and most definitely the same code (I put it below)
To start, this are the main things I am making it with:
6 sets of RGB LED Pixel Lights
1 Knock-off Arduino NANO
1 5v 20A Power Supply
My first problem arose when I received the Arduino Nano. I was able to see it, but not able to write to it. I was eventually able to make it work by using the old boot loader. Let me make it clear, I fixed that problem. But then I short circuited it and bought another one. And now I am faced with the same problem. I have tried using the company's own drivers on the darn thing, same issue.
I was going to put the error here, but when I tried to flash, my computer (Windows) got the blue screen of death. I tried opening the app just now, instant death. So I suppose I'll just reinstall it, just saying, something is MESSED UP with it.
Pretty much, I get the error "the selected serial port does not exist or your board is not connected. "I know for a fact that the COM Port is correct, but it just doesn't seem to like what I am doing.
But I still have another problem. While I had the arduino that I got to work, when I transitioned from using the 5v power supply on it to using the power supply I bought, the lights go nuts. They change to seemingly random colors super fast. But as soon as I change it back to the arduino's power, it was fine. I have tested, and the power output is PRECISELY THE SAME. The arduino just sends out the data for the lights to interpret. I have absolutely no idea why this is happening.
So if you have anything to suggest for either of the problems, I would appreciate it.
Also, here is my code for the lights (sorry this post is really chopped up) It is based on Adafruit_NeoMatrix example
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
 #define PSTR // Make Arduino Due happy
#endif

#define PIN 6

// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//   NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

// Example for NeoPixel Shield.  In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(20, 15, PIN,
  NEO_MATRIX_TOP     + NEO_MATRIX_LEFT +
  NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
  NEO_GRB            + NEO_KHZ800);

void setup() {
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(255);
}

int x    = matrix.width();
int pass = 0;

void loop() {
  static int i = 0;
  i++;
  //matrix.fillScreen(0);
  for(int y = 0; y < 15; y++)
    for(int x = 0; x < 20; x++)
      if(y & 1)
        matrix.setPixelColor(19 - x + y * 20, matrix.gamma32(matrix.ColorHSV((x + y) * 256 * 8 + i * 128 * 2)));
      else
        matrix.setPixelColor(x + y * 20, matrix.gamma32(matrix.ColorHSV((x + y) * 256 * 8+ i * 128 * 2)));

  matrix.setTextColor(matrix.Color(0, 0, 0));
  matrix.setCursor(-((millis() / 30) & 127) + 20, 4);
  matrix.print(F(""));
  matrix.show();
}

Thanks all!
-Micah

Do you connect the GND of the second power supply to the GND of the arduino? The LEDs and the arduino need a common voltage reference on the control pin.

If you disconnect and connect the nano the COM port might change. But in the IDE the it does not change automatically. But this is just a very rough guess. I don't expect this to be correct.

@jsotola Sorry for not being specific enough and cluttering my post, I'll fix that. I was mostly asking in the post if I was missing anything or doing something wrong with the panel because I was having issues.

Thank you so much @PeterPaulKiefer! That actually fixed my light problem! I still need to fix the arduino problems but that you so much!

Update: I ended up just returning the arduino and purchasing another one.


text:
How to run led and buzzer at the same time?
I am making a police light and siren but the delay on light (); affects the buzzers  delay tone
This is the code:
//PIN 9 - Buzzers
int f,d;
int t =0;

void setup()
{
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
}

void loop()
{
    buzzer ();

}

void buzzer () {

  for(f=635;f<=912;f++)
    {
        tone(9, f);
        delay(d);
        d=10;

        light ();
    }

    for(f=911;f>=634;f--)
    {

        light ();
        tone(9, f);
        delay(d);
            d=9;

    }

}

void light() {
 digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  delay(t);

  digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  delay(t);

  digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  delay(t);

  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);

  delay(t);

  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);

  delay(t);

  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);

  delay(t);

  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);

  delay(t);

  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);

  delay(t);

  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);

  delay(t);

  digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

  digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

  digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

  digitalWrite(5,HIGH);
  delay(t);
  digitalWrite(5,LOW);
  digitalWrite(7,HIGH);
  delay(t);
  digitalWrite(7,LOW);
  delay(t);

}

There are 2 ways.  1) State machine. 2) Use the PWM hardware to create buzzer sound.  I would use both.  Comment is you need an more complete answer.

As t=0 you can safely remove the delay(t) lines ;-) And why do you set d=10 after you used it. Wouldn't it be better to set it before the for loop?  You need nearly 300 steps to sweep up and ~ 300 steps to sweep down and for each step you let the LEDs flicker with a patern your eays are not fast enough to see. It that really your intention? I would expect you liked to see the sound sweeps and the LED blinking in parallel. The best way to achieve that is to remove the for loops, and do the things in parallel. See my answer.

@st2000, how do you want to make a siren with hardware PWM?

My bad @Juraj,  the tone() function is already being used.  So all this question needs is a state macing.  Using the mills() function is a step in the correct direction if not a simple state machine already.  A more general state machine solution might benefit the OP as it gives them the bases for more complex software challenges.

The following Code is not tested. You can take it as an example. If you find errors, it would be nice to report them, so I can correct my prog.
// here I just guess (10msec), I think you don't want a delay
// of 0 as in your code.
int   blinkDelay        = 10;
long  lastBlinkTime     =  0;
int   patternSequence[] = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 2, 1, 2, 1, 2, 1, 2 };

int   patternSize     = 17;
int   actPattern      =  0;
int   delActive       = -1;

int  frequency     = 635;
int deltaFreq      =   1;
int  toneDelay     =  10;
long lastBuzzTime  =   0;

void setup()
{
  pinMode( 5, OUTPUT ) ;
  pinMode( 6, OUTPUT ) ;
  pinMode( 7, OUTPUT ) ;

  ledsOff();
  buzzer( frequency );
}

void loop()
{
  int actTime = millis();

  if ( ( actTime - lastBlinkTime ) > blinkDelay )
  {
    if ( delActive > 0 )
    {
      ledsOff();
    }
    else
    {
      actPattern++;
      if( actPattern > ( patternSize - 1) ) actPattern = 0;
      pattern( patternSequence[ actPattern ] );
    }
    delActive *= -1;

    lastBlinkTime = actTime;
  }

  if ( ( actTime - lastBuzzTime ) > toneDelay )
  {
    frequency += deltaFreq;

    if ( frequency > 911 ) deltaFreq = -1;
    if ( frequency < 636 ) deltaFreq = 1;

    buzzer( frequency );
    lastBuzzTime = actTime;
  }

}

void buzzer( int freq )
{
  //PIN 9 - Buzzer
  tone(9, freq);
}

void ledsOff()
{
  digitalWrite( 5, LOW );
  digitalWrite( 6, LOW );
  digitalWrite( 7, LOW );
}

void pattern( int num )
{
   switch ( num )
   {
      case 0:
        ledsOff();
        break;

      case 1:
        digitalWrite( 5, HIGH );
        break;

      case 2:
        digitalWrite( 7, HIGH );
        break;

      case 3:
        digitalWrite( 5, HIGH );
        digitalWrite( 6, HIGH );
        digitalWrite( 7, HIGH );
        break;
   }
}

Update
I've tested the code at home on my esplora. It worked, but not for a long time. I had to change the timing logic, by using the method millis()directly. Now it works. Below is the new code; tested this time. I also introduced some constants on top, because the their names act as documentation ;-). And I experimented with the values. The actual values are my preferences, But I'm by far no Bethoven and can not say if this relly sounds like a police siren. At least, it sounds not like a german police siren which I know better. (No I'm meither a policement nor his/her customer ;-))
Because I tested the code on my Esplora, I had to change the Pin assignments  (now out commented). In this copy I changed back to the original ones.
int   blinkDelay        = 100;
long  lastBlinkTime     =  0;
int   patternSequence[] = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 2, 1, 2, 1, 2, 1, 2 };

int   patternSize     = 17;
int   actPattern      =  0;
int   clearActive       = -1;

int  lowerFreq       = 680;
int  higherFreq      = 840;
int  deltaFreq       =   2;
int  toneDelay       =  20;
int  toneDelayOffset =  -1;
long lastBuzzTime    =   0;

int  actFreqStep   = deltaFreq;
int  actFreq       = lowerFreq;

// orig pins
int col1Pin   =  5;
int col2Pin   =  6;
int col3Pin   =  7;
int buzzerPin =  9;

// esplora pins
// int col1Pin   =  5;
// int col2Pin   = 10;
// int col3Pin   =  9;
// int buzzerPin =  6;

void setup()
{
  pinMode( col1Pin, OUTPUT ) ;
  pinMode( col2Pin, OUTPUT ) ;
  pinMode( col3Pin, OUTPUT ) ;

  // initialize LEDs off
  ledsOff( );

  // and buzzer to the act frequency
  buzzer( actFreq );
}

void loop()
{
  if ( ( millis() - lastBlinkTime ) > blinkDelay )
  {
    if ( clearActive > 0 )
    {
      ledsOff();
    }
    else
    {
      actPattern++;
      if( actPattern > ( patternSize - 1) ) actPattern = 0;
      pattern( patternSequence[ actPattern ] );
    }

    clearActive     *= -1;
    lastBlinkTime  = millis();
  }

  if ( ( millis() - lastBuzzTime ) > ( toneDelay + toneDelayOffset ) )
  {
    actFreq += actFreqStep;

    if ( actFreq >= higherFreq )
    {
      actFreqStep   = -1 * deltaFreq;

      // down sweep is slower
      toneDelayOffset = -1;
    }

    if ( actFreq <= lowerFreq )
    {
      actFreqStep   =  deltaFreq;
      toneDelayOffset =  0;
    }

    buzzer( actFreq );
    lastBuzzTime = millis();
  }

}

void buzzer( int freq )
{
  tone( buzzerPin, freq );
}

void ledsOff()
{
  digitalWrite( col1Pin, LOW );
  digitalWrite( col2Pin, LOW );
  digitalWrite( col3Pin, LOW );
}

void pattern( int num )
{
   switch ( num )
   {
      case 0:
        ledsOff();
        break;

      case 1:
        // red
        digitalWrite( col1Pin, HIGH );
        break;

      case 2:
        // blue
        digitalWrite( col3Pin, HIGH );
        break;

      case 3:
        // white
        digitalWrite( col1Pin, HIGH );
        digitalWrite( col2Pin, HIGH );
        digitalWrite( col3Pin, HIGH );
        break;
   }
}

It's working just like what I want to happen. Thanks

You're welcome. Please do not just copy and paste the prog. Try to understand why and how it works. The world needs more skilled people and you seems to be interested in the subject. I used some things, I learned in 25 years as a developer and they might be difficult for a beginner. If some of the code is unclear, please fell free to ask me here. I would be happy the help you understand and perhaps you find a hidden error, I've overseen.

Don't use delay(). You'll need to rewrite your sketch to use the millis() function to decide when the desired amount of time has passed. Search on "Arduino Blink Without Delay" for information.


text:
Arduino beginners kit example not working
I bought a beginners kit and can get all but one of the examples to work. I have tried different board layouts and varied the code with no success. When I first run the code the LED is off. When I ground pin 9 the LED comes on and stays on. Grounding pin 8 does not turn off the LED once it is lit.
int ledPin = 5;
int buttonApin = 9;
int buttonBpin = 8;

byte leds = 0;

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

void loop()
{
  if (digitalRead(buttonApin) == LOW)
  {
    digitalWrite(ledPin, HIGH);
  }
  if (digitalRead(buttonBpin) == LOW)
  {
    digitalWrite(ledPin, LOW);
  }
}

Code should read:

Does pin 9 stay grounded after the LED turns on? If you ground both pins with that code you will have the LED at about half intensity, since you are turning it off and on very fast

Pin 9 is only grounded momentarily but the LED stays on afterwards. After I press the button and release I assume both 8 and 9 are floating, but neither are grounded until I press a button again.

I have tested this with your wiring and your code and it works like a charm. I can turn off the LED with the button at pin 8. You must have done something different, than you stated in your question

Thanks Chris. I will have another go. I have tried a few times now with no success and different configurations.

Maybe you can post a good photo of your actual circuit. And some breadboards have the outer rails divided in two parts. If that is the case, button 8 would not be connected to ground. Please check that.

Thanks Chris. Works now. May have been a bad connection.

A multimeter can be useful in troubleshooting hardware setups. You could use it to check that pin 8 is actually being shorted to ground when the button is pressed, for example. (Set the meter to continuity mode, attach one lead to a spare ground on the Arduino, and the other to the pin 8 section of your breadboard. The meter should beep when you press the button. If not, start working backwards until you figure out where you have an open circuit.

touch the yellow button to ground instead of pressing the button

If you have conected it exactly like in the image, maybe you've got breadboard with power rails separated in the middle (I've got plenty of them and they all have this "feature"). However it's also displayed by colored lines next to it. If there is a space in the middle, it's not connected

This kind of button has 4 pins. These pins are internally connected in pairs. It's easy to make a mistake when wiring. Please post the real picture of your wiring. Or you can refer to read more about button pin in this post


text:
Temperature and Humidity Sensor TinyShield (No device found on com5)
Hi i have recently started working on a Temperature and Humidity Sensor TinyShield (ASD2511-R-T) and faced the issue as shown in the image below: No device found on com5.

I have followed the tutorial as shown in the TinyShield webpage and worked through the steps. 1) Installed the Arduino IDE, 2) Installed the Si7021 Arduino Library, 3)Download the .zip file of the example program and open it in the Arduino IDE.
This is the following example code provided by the tutorial.
/*
  TinyCircuits Si7020 Temperature and Humidity Sensor TinyShield Example Sketch

  This demo shows the bare minimum to read temperature and humidity data from
  the Si7020 sensor using the Si7020 library written by Marcus Sorensen.

  This example is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  Written 20 March 2016
  By Ben Rose
  Modified 07 January 2019
  By Hunter Hykes

  https://TinyCircuits.com
*/

#include <Wire.h>
#include <SI7021.h>

SI7021 sensor;

void setup()
{
  Serial.begin(115200);
  Wire.begin();
  Serial.print("Initializing sensor... ");
  if(!sensor.begin()){
    Serial.println("Sensor not found!");
    while(true);
  }
  Serial.println("Success!");
}

void loop()
{
  int celcius=sensor.getCelsiusHundredths()/100;
  int relativeHumidity=sensor.getHumidityPercent();
  Serial.print(celcius);
  Serial.print(" deg Celsius\t");
  Serial.print(relativeHumidity);
  Serial.println("% relative humidity");

  delay(500);
}

However, when I proceed to upload the program, the following error had occurred. This is the first time i am working on a TinyShield product.
Any help is appreciated! Thanks!
Do let me know if i need to provide any further information.
The options for COM 5 the only one avaliable.

why did you choose COM5 as the serial port?

The error indicate that your Arduino is NOT connected to COM5 !

Hi, that was the only options available in the port option when i connected it. I have added the screenshot in the post.

The below was the issue, i was using the wrong broad and processor.
Thanks for the help!


text:
I am trying to combine a button's coding and servo's coding. But it is still cannot be verified. What have I done wrong?
include
Servo myservo;
void setup(){
  myservo.attach(8);
   pinMode(buttonPin, INPUT);
}
void loop()
{
  myservo.write(0);
  delay(3);
  myservo.write(90);
  delay(3);
}
 const int inPin=8;
 const int outPin = 9;
 int currentState = LOW;
  currentState = digitalRead (inPin);
  if (currentState== HIGH)
    digitalWrite (outPin,HIGH);
   else
    digitalWrite (outPin,HIGH);
   delay(10);
 }

Do NOT use two loop() and setup() function.
You can refer to a similar combination between Servo Motor code and Potentiometer code here.

Thanks for the wonderful website


text:
Is it possible to connect from esp8266 module over HTTPS protocol?
Before I will implementing some server application for Arduino client I should know:
Is it possible to connect from esp8266 module to end-point over HTTPS protocol?
Any links of tutorials are welcome.
Thank in advance.

yes, it is possible. there are examples in IDE Examples menu

Yes it's possible. Try this one tutorial.
https://circuits4you.com/2019/01/10/esp8266-nodemcu-https-secured-get-request/