Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [programming]

The process of designing and writing source code as part of a program (or sketch) for Arduino. Do not use for uploading to an Arduino board.

1
vote
1answer
12 views

How to combine strings and text together?

I'm trying to combine two strings (strings/int) together with text in below code: int foo = String((char*)payload).indexOf(' '); int message1; int message2; message1 = String((char*)payload)....
1
vote
1answer
33 views

Does Arduino C++ support dynamic arrays of objects

My C++ is seriously out-of-date, and I'm working on a project that will be juggling multiple timed actions at the same time, with a menu system to manage the interface and control those timed actions (...
1
vote
1answer
33 views

Serial not declared in this scope, newbie mistake most likely

Ok, newguy with a little VBA coding experience going to pull hair out soon. It is probably a simple thing I have missed but I would like someone to point out where I went wrong. I modified a sketch ...
1
vote
2answers
73 views

Need help with the syntax for a function that takes a closure [on hold]

My C++ is very out-of-date. (20+ years, before C++ had closures). I'm a senior SW engineer, and I spent several hours yesterday trying to figure this out, but I could not work it out. The background:...
0
votes
1answer
30 views

how can I upload a hex file to an arduino uno?

I have a Rostock Max 3d with an Arduino Uno as the controller. The OEM has a firmware version I would like to upload, but it is in the hex file format. I have looked all over the Arduino IDE, but ...
0
votes
1answer
51 views

what does * command when using it with string? [on hold]

I want to figure out what does "*" command? For example code below; int numOfRegisters=2; byte* registerState; void setup() { registerState = new byte[numOfRegisters]; for (size_t i = 0; i < ...
1
vote
1answer
24 views

Dynamic allocation/ Pointer to Pointer to update an Array containing parameter [on hold]

topicArray defined as follows: const char* msgTopic = "Home/Messages"; const char* groupTopic = "Home/All"; char* deviceName = deviceTopic; const char* topicArry[2] = {deviceTopic, groupTopic}; But ...
0
votes
0answers
28 views

How do I spilt a string of data into four different parts [closed]

The string has seconds, miles away from our point and latitude and longitude, and all we need is the lag and long 4271.645999999997,s,28.00301266666665,mi,28.48737418308778,N,-81.36210510944983,E. we ...
0
votes
0answers
31 views

How can I control 4 DC brushless motors with an Arduino Uno? [closed]

I need all the motors to simultaneously spin at 80 rpm in the clockwise direction. I am looking for the cleanest set-up, along with the code. I have very limited experience coding or working with ...
0
votes
0answers
23 views

Fujitsu FMC-16LX(MB90F387) Pulse Sensor BPM formula displaying only 96BPM

#include "_ffmc16.h" #include "extern.h" #include "monitor.h" void initLCD(); void delay(); void instCtrl4(unsigned char data); void display(unsigned char temp); void display1(unsigned char pulse, ...
0
votes
1answer
49 views

Newbe needing help with fixed string length

im trying to build a bit of test equipment that will talk to some software and it needs to send a fix string. when the voltage changes the string length does as well. i need to cap the results to 4 in ...
0
votes
1answer
29 views

Digispark Attiny85 ultrasonic sensor input problem

I was trying to use ultrasonic with digispark Attiny85 board and used separate pins for trigger and echo, and used MM5451 led controller as a display, I uploaded the code successfully the problem is ...
0
votes
1answer
19 views

servo starts rotating whenever it is plugged

I am making a fish feeder using an Arduino Mega 2560, servo motor SG90 and RTC DS3231. I want to make it rotate twice a day, i.e. morning and 9 o'clock evening. Whenever I plug my Arduino board to ...
0
votes
1answer
39 views

CPU information on Arduino Serial Monitor

how to show the CPU temperature, CPU usage (percentage) and the memory usage(percentage) in Arduino Serial Monitor.
1
vote
4answers
159 views

How to blink led and run another code at same time?

I had written a code to calculate rpm of the motors using IR sensor and Arduino nano and displaying it on OLED . With that I want an LED to blink always. Here is the code what I did: You can skip the ...
-1
votes
0answers
25 views

Setting up Atmega328-P on own PCB correctly for programming

I am working on going from an arduino board to a PCB. However I am not sure if I am setting up the microcontroller correctly (Atmega328-P) My circuit design can be seen in the picture below and I ...
0
votes
0answers
26 views

Installing ESP 32 in Arduino IDE

What to do if in Arduino IDE boards manager, installation is stuck at "Downloading tools (3/3). Downloaded 38,190kb of 125,719kb." when installing ESP32 on Arduino IDE? I have not connected the ESP32 ...
0
votes
1answer
30 views

New code results in audio noise

I am working on a circuit that can record audio to an SD when a switch is HIGH and stop recording when the switch is LOW. I am using the TMRpcm library. I previously had an issue solved on these two ...
0
votes
0answers
18 views

error while uploading a code

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno" avrdude: can't open input file C:\Users\PETER_~1\AppData\Local\Temp\arduino_build_223764/nyu_probe_activity1_code.ino.hex: No such file or ...
0
votes
3answers
25 views

Code getting stuck waiting for GPS Output

I'm basically trying to make a device that pulls the GPS information from a SIM808 and pushes it to a server online via GPRS. I am sorry as I am not good at programming so ive spent days trying to ...
0
votes
1answer
19 views

Trying to save .wav files with new name every loop

I have built a set up with an Arduino UNO hooked up to a switch, so that whenever the switch goes from HIGH to LOW it saves audio to an SD card. I am using the TMRpcm Library. The problem is the ...
0
votes
1answer
110 views

How to use map function

I want to know how to give if else statement in servo knob example. I want to control one servo motor, with one pot with various max angle, with respect to if else condition. I had try if(pin10==...
1
vote
2answers
41 views

Most efficent way to adjust value

I am working on a system that starts a process based of a set time value (startHour). The user sets the start hour and can only select values from 00-23. I have been asked to start the same process at ...
0
votes
2answers
55 views

How to read a PWM OUTPUT PIN value?

How to get a pwm pin value that is in pinMode OUTPUT? How to get a digital OUTPUT PIN value: #define pin 3 void setup() { pinMode(pin, OUTPUT); Serial.begin(9600); } void loop() { delay(...
0
votes
2answers
45 views

Rescuing an Arduino With a Broken Setup()

I may have bricked my Arduino Pro Micro by writing a broken code into the setup() function. When I plug my Pro Micro into my PC, I see it register a COM port for a brief moment before it disappears. ...
0
votes
1answer
42 views

Arduino ultrasonic sensor project

I'm a newbie at Arduino, and I'm trying to make a project with ultrasonic sensor, I'm using the grove ultrasonic ranger, not the HC-SR04, and I already did test with distance and it worked very well, ...
-1
votes
2answers
59 views

Why won't my code play a tone for my arduino

I have the following code that I use to try to play a melody on my Arduino, but there is no melody just a tapping noise. I am using the built in tone() function to play on a speaker/buzzer. I know ...
3
votes
1answer
56 views

Unexpected behavior of ++myCount

I'm new to Arduino and C. This behavior is not what I'd expect: Serial.begin(9600); while ( ! Serial ); int myCount = 0; for (int i=0; i<10; i++) { myCount = min( ++myCount, 8 ); Serial....
0
votes
2answers
23 views

strtok keep original char [closed]

I want to make a vocab program for an arduino. The vocabs are saved in a char array seperated with an '/'. Now I want to split a random picked char and split it at the '/' so I can save it into two ...
1
vote
1answer
56 views

Getting two Arduinos to talk to each other via an optocoupler [closed]

I've setup two Arduinos connected via an optocoupler on a breadboard. One Arduino is a sender and sends pulses to the optocoupler causing the diode to turn on. When this happens the other Arduino ...
0
votes
1answer
23 views

Getting at the PS_ON pin on a RAMPS1.4 mounted to a Mega

Got it! Check end of post for solution. I'm running a Mega 2560 with a RAMPS 1.4 Shield which is usually used for 3D printing applications. For my use case I only want to get at the stepper motor ...
1
vote
1answer
77 views

how to simplify code

I am as new as new can be to the Arduino world and have been playing around with them. I have a few "Arduino Uno" boards that I purchased and have successfully loaded sketches to them. However I am ...
1
vote
3answers
85 views

Is arduino a single board computer? [closed]

First excuse me if tags are not reflecting the content, While watching a video about single board computer (SBC) I got confused that it doesn't mention arduino as SBC. I always considered it as SBC. ...
0
votes
1answer
26 views

Ultrasonic sensor and ledstrip color problem

So I've made a parking sensor with the Ultrasonic sensor and a ledstrip. But the ledstrip doesn't turn yellow or green. I think it has to do with the Thresholds. Can anyone help me to set this up? I ...
0
votes
1answer
35 views

programming relays wit millis code

Trainset info, Turnout 1 = relay 1 - makes turnout track go left = relay 2 - makes turnout track go right Turnout 2 = relay 3 - makes turnout track go left = relay 4 - makes ...
0
votes
1answer
108 views

Combining two code of two sensor in one program

I'm using two sensors, which is Galvanic Skin Response sensor and Heartrate sensor. The problem is that when I combined both of the codes, the only output that is showing up is from Heartrate only ...
1
vote
1answer
182 views

getting error 'Serial' was not declared in this scope

I am adding Dust Sensor to my particle photon project at home, I got this GitHub project that I want to test before implementing a final code. I am not an expert in cpp, I wanted to modularise the ...
0
votes
2answers
37 views

How to read sound sensor readings and light up sensor with water sensor if the readings is above threshold & when water is detected for 2 mins?

I am student that is new to Arduino and working on a project to trigger an alert if the sound level detected exceeds the threshold for a period of 2 mins. But I am stuck, would like to check how do I ...
0
votes
1answer
26 views

Hot Swap Sensor

Is there a way to have a sensor be hot swappable, as in it can be disconnected and reconnected without locking up the Arduino? I have an I2C sensor that I want to be able to disconnect and reconnect ...
0
votes
1answer
46 views

How to solve this “xpected primary-expression before ',' token”

I'm new in this arduino world, and I'm having some trouble. I am programming something for a school assignment. The program gives an error, and my teacher also doesn't know how to solve it. Maybe ...
0
votes
2answers
64 views

Need some help in coding a “timer” in an if else statement

I want to code something like a "timer" (don't know what to call it) in an if else statement in my arduino uno. Basically I have 2 buttons. If the button1 is pressed and button2 is also pressed in a ...
0
votes
1answer
24 views

how to use arduino to detect an 8Mhz ultrasonic pulse using piezo disc as receiver?

i need a code to detect an 8MHz ultrasonic pulse and show its properties eg wave pattern and amplitude on serial plotter( like an oscilloscope)
0
votes
3answers
34 views

If a condition is ever met I want to run a loop permanently

I am trying to run an LED to do SOS in morse code if a temperature is over 20 C and motion is detected, but I want it to continue doing SOS even after the motion goes away or the temperature comes ...
0
votes
1answer
50 views

Can I use arduino to generate 8mhz frequency ultrasonic pulses in piezo discs?

void setup() { pinMode(freqOutputPin, OUTPUT); Serial.begin(9600); // Set Timer 2 CTC mode with no prescaling. OC2A toggles on compare match // // WGM22:0 = 010: CTC Mode, toggle ...
1
vote
1answer
34 views

Remove all items from an array [closed]

i'm trying to remove all the data i've in an array. Example: I've arr[5,3,2] and i want to clear the array totally and finish with an array like this arr[], ready to add new values. How can i do that?...
0
votes
2answers
64 views

How to burn bootloader into arduino uno without using another arduino

I need to bootload my Uno board but I do not have another Arduino at my disposal so how do I bootload without another Arduino board
0
votes
1answer
55 views

How to send an integer through pyserial with Python to an Arduino and get back the same result?

There has been similar questions all over the internet but none of them seem to answer my question, so can anybody tell me what is wrong with this code and how I can fix it? Python code: import ...
0
votes
1answer
19 views

Global Variable does not Change when Value is set within Boolean Function

I have a boolean function which contains a string. In my main project this string is extracted from a website using an ESP8266 which is compatible with the Arduino IDE. I need to convert this string ...
0
votes
1answer
49 views

Value assignment on Arduino

I have a thermocouple k. I want this thermocouple to select the first value OF TEMPERATURE that it read and assign it to a variable in an Arduino program. How should I do that?
0
votes
1answer
52 views

How do I stop the slave from running the code until master sends a new value? I2C

I'm a total noob when it comes to Arduino. I'm slowly learning stuff. I was trying this code which basically gets input in Arduino1(master) and displays the character in serial monitor of Arduino2(...