The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1
vote
1answer
42 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
23 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
85 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
42 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
63 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
36 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
33 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
25 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
37 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
27 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
80 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
25 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
0answers
28 views

What happens if I pass a temporary reference and store it as a class member? [migrated]

I have a class that stores a reference to some kind of application state, which it then mutates during operation: class Mutator { private: State& _state; public: Mutator(...
0
votes
1answer
28 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
40 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
38 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
35 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
21 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
27 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
29 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
100 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
35 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
34 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
55 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
100 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
33 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
28 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
40 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’...
0
votes
1answer
37 views

Can I use only Ruby or Crystal Lang with an Arduino?

I am new to Arduino. I have used other SBCs before and ran some ruby script to automate many tasks. I know Ruby and Crystal programming languages. Can I use Ruby or Crystal solely on Arduino for ...
0
votes
0answers
33 views

Error: " stray '##' in program in

I am trying to use #define in Arduino IDE as I used to do in Atmel Studio like: #define PROGRAM(N) void PROG_##N(void) However I am getting a stray error because of the hashes, is there a way to ...
1
vote
1answer
61 views

#define above static const int?

I see a lot of people, but also libraries, defining constants (like pin numbers, length of items etc) as #define: #define LENGTH 5 While it is recommended to use in this case static const int: ...
1
vote
2answers
113 views

How to actually concatenate two Strings?

I'm using the SPISlave library, and I have the following code snippet: String arg; SPISlave.onData([arg](uint8_t *data, size_t len) { data[len] = 0; arg += String((char *)data); // ... } The ...
0
votes
1answer
34 views

Why do I see error in this code

NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE); AF_DCMotor motor1(1, MOTOR12_1KHZ); AF_DCMotor motor2(2, MOTOR12_1KHZ); AF_DCMotor motor3(3, MOTOR34_1KHZ); AF_DCMotor motor4(4, MOTOR34_1KHZ); ...
0
votes
1answer
62 views

How to scale a bitmap (uint8_t array) in Arduino?

So I have a project where I send text to an Arduino, which is then printed out as a QR code on a thermal printer that can take a bitmap image with a given width and height. Is there a way I can "...
0
votes
1answer
23 views

ESPAsyncWebServer how do you escape the % character?

% characters are used for template processing but I want it to just send the % through. How do you tell it to do that?
0
votes
1answer
45 views

Forward kinematics of a differential drive robot

I've been braking my head over this for the past few days and can't make it work.. So, I have a small robot with a rotary encoder on each wheel and i want to track its position (in x and y) on a flat ...
0
votes
1answer
35 views

Waking Arduino from sleep with an ultrasonic sensor

I have a parking guide using an ultrasonic sensor (HC-SR04), based on the instructions here. I'm trying to modify the code so that the Arduino goes to sleep after a certain period of inactivity (say, ...
0
votes
0answers
34 views

Can I determine if I have been pinged?

I have a project using a Wemos D1 Mini. Is there a way for the sketch running on the Wemos to know when it's been pinged?
0
votes
0answers
31 views

Rocket deploy system

I found a code from Astronomica Messier that allows to activate a servo from a Gyroscope MPU 6050 change in direction. I followed the wiring and uploading correctly. The thing is that the MPU is ...
0
votes
1answer
30 views

Error: “'lcd' does not name a type” using LiquidCrystal library

I'm following an online Arduino tutorial/course and trying to make a simple moving character on an LCD screen, but for some reason I get the following error: "error: 'lcd' does not name a type". I'm ...
1
vote
1answer
54 views

Merge two 8 bit arrays to one 16 bit array

I am an absolute newbie to Arduino and C++ and try to go through some tutorials to gain a minimal insight. However I stuck already at some tiny Points. What I want to do? Merge two 8 bit integer ...
0
votes
0answers
30 views

My alterate flashing LED program is not working

I am trying to program my Arduino UNO ATMega 328p in assembler to implement a flashing pattern with two LEDs. When one LED is off, the other must be on. I have made a program but it is showing errors ...