We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [programming]

The process of designing and writing source code as part of a program (or sketch) for Arduino. For questions about uploading code to an Arduino board, use the [uploading] tag instead.

Filter by
Sorted by
Tagged with
0
votes
2answers
16 views

How to use ATtiny pins that are usually 'reserved' for chip programming?

How to program an ATtiny45 to use the pins 1, 5, 6, 7 (i.e. PB5, PB0, PB1, PB2) as input or output? pinMode(5, OUTPUT); pinMode(0, OUTPUT); pinMode(1, INPUT); pinMode(2, INPUT); digitalWrite(5, HIGH);...
1
vote
1answer
22 views

cant figure out how to fix this compile error

evrything worked for a bit and changed to much to get it working again. dont really understand the error. [![C:\Users\bavob\AppData\Local\Temp\ccyfrkaL.ltrans0.ltrans.o: In function `loop': C:\Users\...
0
votes
2answers
34 views

Help with Stair Lighting using HC-SR04 sensor and WS2812 LED Strip

Excuse my naivete in this as I am very new to Arduino and the programming of. I am trying to put together a project for stair lighting triggered by a ultrasonic sensor at the bottom of the stairs and ...
0
votes
1answer
29 views

DS3231 + button to trigger light

please can someone help me with code, i want to have automatic trigger on specific hour, also i want to have button switch if needed, in my code i can press the button to trigger light relay, but my ...
0
votes
0answers
10 views

nodemcu nack error bh1750

I am trying to run a simple example of bh1750 on my nodemcu, code is #include <Wire.h> #include <BH1750.h> */ BH1750 lightMeter(0x23); void setup(){ Serial.begin(9600); Wire.begin(...
0
votes
1answer
34 views

Creating an array with the length coming from a library

When creating an array like in the sketch #include <Lib.h> int myArray[Lib::len]; void setup() {} void loop() {} the variable len must be an integer constant that is known at compile time. ...
0
votes
1answer
24 views

Error: invalid application of 'sizeof' to incomplete type 'int []' when trying to compute the size of an array in a library

I have created a library that contains an array. This is the .h file: class Lib { public: static int arr[]; }; And this is the .cpp file: #include "Lib.h" int Lib::arr[] = {0, 1, 2, 3}; ...
0
votes
1answer
18 views

Arduino - Extracting Multiple Strings from Serial Read

I am trying to write an Arduino code that reads a long string, example <11,22,33>, through the Serial Monitor and then stores the 11,22, and 33 into separate bins of a matrix array. So the user ...
0
votes
1answer
38 views

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 ...
0
votes
1answer
33 views

Is if statement correct?

if(temperature < baselineTemp)else{ digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); }else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){ ...
0
votes
0answers
11 views

How to solve MPU9250 overflow problems? [migrated]

I'm now working with mpu9250 for my master thesis, but I'm quite new to hardware device. My goal is to collect the data at the sample rate and postprocess these data via allan deviation. So I just ...
0
votes
0answers
32 views

Arduino Due: Measuring the time between pulses

I have a 'pulse train' generated from a photo interrupter and slotted disc mounted on a rotating shaft. My goal is to measure the time between each rising edge. I have looked at the data sheet for ...
-1
votes
1answer
44 views

Program for counting days

I need a program to count days, from day 1 to day 21 for my project. I'm making an artificial incubator and I need to show the days on an LCD.
-1
votes
0answers
38 views

Robot code is not running properly [duplicate]

I have an obstacle avoidance program that came on my robot (Elegoo uno R3 smart car) and all I've added to it is the remote program but for some reason that code only works for one time. what i mean ...
0
votes
2answers
75 views

Yet another basic and silly question about C++ strings

I made a sketch like this: void setup() { // put your setup code here, to run once: Serial.begin(9600); char str1[64] = "test with spaces"; char str2[32] = "test with spaces"; Serial....
1
vote
1answer
53 views

Can someone help me solve a loop question and a couple others for my program?

I am currently working on the elegoo uno r3 smart car kit that uses arduino. I have written some code and it works for the most part but I could use some help. I am trying to figure out what i need to ...
0
votes
1answer
44 views

Privacy of a program

I have created a algorithm and using arduino harware, and I don't want that users of my hardware could read or copy the Program so is there any security code or something that I could use. But I must ...
0
votes
0answers
26 views

Made a light controller for the holidays

I am a new the world of Arduino. I found on YouTube, how to build a light controller (https://www.youtube.com/watch?v=WvG9c84ApFA&t=39s). I follow every step but it doesn't work. Here are some ...
0
votes
3answers
86 views

pin going high not allowing analog read to change

I have the following problem: My arduino takes analogRead(A0) from a potentiometer whose position I can't adjust directly. When analogRead(AO) goes to a value X, I want pin 8 to go HIGH, this ...
-1
votes
1answer
44 views

Have I fried my arduino uno?

I made a smart dustbin using arduino, servo motor, & ultrasonic sensor. It worked pretty well for a few number of days. But once I don't know how but the Arduino 'ON' light started to become dim ...
0
votes
1answer
67 views

I don't know how to do the code for an rtc controlling a relay

I'm doing a project for my brother witch is an automatic watering thing, it's all working fine but I just don't know how to repeat the code to make the relay say come on for 5min at 0900 than 5min at ...
0
votes
1answer
41 views

'TCCR1B' was not declared in this scope

I'm trying to use a MS5540C (digital pressure sensor) and the sample code has this line: TCCR1B = (TCCR1B & 0xF8) | 1; //generates the MCLK signal I'm a bit of a noob to the IoT but its not ...
0
votes
0answers
34 views

Where is tcp.c?

This question is related to my other question, which I already answered. I want to add modify tcp.c to include my own code. The problem is I can't find tcp.c. The first thing I tried was looking in ...
0
votes
0answers
28 views

HC-SRO4 always returns zero no matter what I do?

Wondering if it's the sensor or the code? can anyone help? I've used the code here /* HC-SR04 Ultrasonic Sensor with LCD dispaly HC-SR04 Ultrasonic Sensor VCC to Arduino 5V GND to Arduino GND ...
0
votes
2answers
39 views

Is digitalWrite(pinnumber,LOW) different from ground pin

I am using Tinkercad simulator, but an unusual thing happened. When I connect one wire of dc motor to pin 9 with digitalWrite(9,HIGH) and other wire to ground, the motor runs with rpm of 5555. void ...
0
votes
1answer
35 views

Where is tcp.h?

This is for an esp8266 project that uses EasyAsyncTCP. In EasyAsyncTCP.cpp they #include "lwip/tcp.h". But I can't figure out where that file is. I've found a tcp.h in the following directories on ...
0
votes
2answers
82 views

Dice is not showing the correct numbers

I've made a dice roller (to make it easier to roll the dice) using an Arduino UNO and an LCD keypad shield but I can't get the correct numbers (1, 6 (7)) to show up, I've tried using int, float and ...
0
votes
0answers
27 views

I cant seem to form a code to read both DHT11 and pulse sensor

I combined both the heart pulse sensor code and the DHT11 code. I can get a decent reading from the pulse sensor however an error is given from the DHT11 sensor. I am able to get them to function ...
0
votes
1answer
31 views

Expected unqualified-id before 'public'

I'm making an arduino program for a buzzer that you can record notes and song for and then play them back. I have 2 arrays that hold both pitch and if a note is being played. I continue to get errors ...
0
votes
2answers
41 views

Why can't I control speed of the motor? (M1 and E1)

When myservo_1,myservo_2,myservo_3,myservo_4 is commented, I can't control the speed of my M1 motor. But only when I uncomment myservo_1 and so on, I can control the motor speed again. Can someone ...
0
votes
2answers
45 views

Using an Arduino Nano to program (as ISP) a standalone 328p

I uploaded the ArduinoISP sketch to an Arduino Nano to use it as a programmer for other chips. It worked successfully to program an ATtiny45, I did the usual wiring between them, and added a 10uF ...
0
votes
0answers
43 views

pin change interrupt on arduino Due

Greeting! I am finding it difficult setting up a pin change interrupt on an arm board ( I am using Arduino due). I found a sample online which I have used but I discovered that when ever an interrupt ...
0
votes
1answer
22 views

Blink Adafruit_NeoPixel

I wish to blink all the strip. In the code below it just blink the first LED, how can I fix it? Code: #include <Adafruit_NeoPixel.h> #define PIN 6 #define NUM_LEDS 24 Adafruit_NeoPixel strip ...
0
votes
0answers
33 views

how to get text box values from webserver of esp32 and print them in to serial monitor by using <webserver.h> library

Actually I'm trying to get the values from esp32 server webpage. Suppose there is a web page containing some text box fields, user has to enter some details in it and this details I want to be print ...
3
votes
3answers
2k views

How do I extract code from an arduino? [duplicate]

I updated and uploaded some code on another computer that got wiped and didn't send the new code to my current computer, the updated code is still on the board but I don't have access to it. How do I ...
1
vote
1answer
28 views

Are there any standard ways of reporting a runtime error?

I'm new to Arduino but I'm an experienced programmer. I'm wondering if there are any common functions for reporting errors in Arduino programs? For example, in JavaScript we have the alert() function, ...
0
votes
1answer
33 views

How to add indicator lights to button sketch

I would like to add leds to each button switch in the first code, The first code sends midi messages to a DAW I would like it to also turn on a led as an indicator light. The switch needs to turn the ...
0
votes
0answers
12 views

Trying to get pseudorange data out of NS-RAW GPS

I have an NS-RAW CPGPS and I am trying to get GPS Data using an arduino. Do I just use the serial to get the data out of it and just convert and extract the data to what I need?
2
votes
1answer
121 views

Weird Arduino Code Problem

I'm currently getting started with Arduino, so I do not have very much knowledge. In this project I have a receiver and a transmitter with 2 buttons. So, I'd like to switch something to on, when I ...
0
votes
1answer
43 views

24/14 second countdown timer or shot clock for basket ball start/stop button doesn't respond well

Start button doesn't respond correctly, i can't figure out whats wrong with the code ? pls help, this code is for 24 second and 14 second countdown timers in a same unit comes with three physical ...
-2
votes
1answer
29 views

Can an arduino Uno control led, sound and smoke?

I'm pretty new to this and I've not seen anyone answer this question yet - so I figured I would ask. I have a vape mod that is set up to expel smoke with a trigger. I want to merge this trigger to ...
0
votes
0answers
39 views

Attiny85: how to rotate the servo continuously with a press of a button?

I'm trying to use two Bluetooth commands in my code: one is press off a button "1" the servo should do its routine without stop second one press of the a button "2" servo should stop. What am I ...
0
votes
1answer
57 views

How do I convert this program to assembly from c++

I am trying to implement a program in assembly code for an Arduino UNO. A potentiometer is used on an ADC pin for variable time (t). LED1 flashes for t seconds, then stays on for t seconds, then goes ...
0
votes
4answers
101 views

Can I do something like this to simplify the code for arduino?

Can I simplify the code in arduino where it doesn't promote any error. Example: Int led =13; Blink = digitalWrite(led, HiGH); delay(1000); digitalWrite(led, LOW); ...
0
votes
2answers
40 views

How do I code the release of a momentary touch sensor in IDE?

I am a performing musician and quite new to the Arduino community. Just learning as I go. I am interested in using a momentary touch sensor with Adafruit's MP3 shield or Wave Shield. I have ...
0
votes
0answers
18 views

A small problem that I cannot detect, My steppers are not moving for some reason …?

I'm working on a similar project that can be found in this link https://howtomechatronics.com/projects/arduino-mecanum-wheels-robot/ It's the same build. To control the 4 steppers (via the NRF24L01), ...
0
votes
0answers
54 views

Ethernet TCP communication between two arduinos not working

So I've got two arduinos Leonardo ETH, both plugged into a local network I host on my computer, and I'm trying to make them communicate through ethernet. One of my arduinos is collecting data from 2 ...
0
votes
1answer
32 views

How can I stop a loop when using a servo with a Key input?

How can I stop my following code using a key? Basically the code should run the servo in a loop if "t" is pressed and stop the loop if "s" is pressed. #include <Servo.h> Servo myservo; // ...
0
votes
2answers
38 views

How to include Vref in thermistor temperature calculation?

simulate this circuit – Schematic created using CircuitLab This is the code that I'm using to get the temperature: #define COEFF_A 0.8662984364E-03 #define COEFF_B 2.780704551E-04 #define ...
-2
votes
1answer
41 views

What hardware do I use to detect an electric current going to a lightbulb and tell if it is turning on and off [closed]

I’m doing a project where you have to detect a lightbulb coming on through the electrical current and was wondering what Hardware and what the program is? Can y’all help? Very much appreciated if y’...