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
2answers
44 views

What exactly does the Arduino preprocessor do?

Arduino claims to be a "language," not just an "application framework," and Arduino files have their own extension, .ino. The language is obviously C++, but not quite. My understanding is that ...
0
votes
1answer
23 views

endless iterations a function in arduino [on hold]

legend: Yi = Y new Yi-1 = Y old i want to make this in my arduino my function Yi = Yi-1 +6 start y0 = 0 ==================================================== Y1 = Y0 +6 = 6 Y2 = Y1 +6 = 12 Y3 =...
0
votes
1answer
65 views

Will this sketch eventually fail because of integer limit issue?

I am a novice in Arduino programming and I'm setting up an Arduino controlled, underwater time-lapse camera to take a picture every 2 hours. It's going in the ocean for a month and I want to be sure ...
0
votes
1answer
65 views

Why are my if statements acting like the condition is always true? [closed]

Here is my code. My issue is is that the keys are getting "pressed" even though there is nothing jumping any of the pins on the arduino. // UNO-HIDKeyboard-Library - Version: Latest // This ...
0
votes
0answers
15 views

VC0706 camera and a corrupted jpeg image [closed]

I've bought a jpeg camera (C429-L36). With some examples found on the internet, I've done this program: int main() { int USB = open( "/dev/ttyUSB1", O_RDWR | O_NOCTTY | O_SYNC ); struct termios ...
0
votes
1answer
19 views

ESP8266 upload data to google cloud platform

I am trying to upload information to my appspot created with Google App Engine. I am able to do it when I in my browser type: http://myname.appspot.com/query?city=Copenhagen&temp=20&id=website ...
0
votes
1answer
44 views

If/Else Statements on Arduino not executing

I have a bit of code below, the problem is only the first 'if' statement will execute when called on. When I call on u, q, or any of the other if statements it will go straight to the else and not ...
0
votes
3answers
63 views

(ultrasonic sensor code : No such file or directory)

I'm beginning in Arduino I do not understand what the error means. Please tell me where I can find the resources to understand it and allow the code to compile. #include <RCSwitch.h> #include &...
-1
votes
0answers
19 views

Trouble with posting code correctly [migrated]

Why is it that the code I have posted appears jumbled up but looks normal when inserted between brackets?
-1
votes
1answer
58 views

State change detection with a colour sensor

I have added static variables to this code and instead of getting repeated notes whilst dwelling on green, I get a single note instead. This is what I wanted. However, my loop isn't allowing for a new ...
0
votes
1answer
35 views

Neopixle animation help

Ok I'm stupid when it comes to coding. I have a simple project that I need some help with. Is it possible to make neopixle change what animation runs via multiple switches. Example they stay off till ...
0
votes
2answers
60 views

Where is my BUG?

Thank you everyone for help on my last post, i managed to make it work. I still keep trying to craft my skill with the arduino. This time I need to make a coffee hot plate simulation. When the ...
0
votes
1answer
41 views

Formula creation

I was creating a scoring formula for a game. The formula in question is millis() * 1.1 ^ (millis()/10000); However, I'm having trouble understanding the different error messages that the Arduino ...
0
votes
2answers
28 views

Read sensor data repeatedly after specified time?

I want to read sensor data using analogRead() after every 5ms. I have read other answers to similar questions but what I'm confused about is: let's say, I made a loop to read sensor data using ...
0
votes
0answers
28 views

WiFiNINA not connecting - return any errors

I am very new to Arduino and using the ConnectWithWPA example for WiFiNINA on my new Mkr1010. I inputed the pass and network id in the arduino_secrets.h file: #define SECRET_SSID "DenMember" #define ...
0
votes
2answers
63 views

Getting FFT arduino code to run over 9+ hours, utilizing micros()

I am a beginner in Arduino, coding, and electrical engineering (learning on my own time) and am working on creating an EEG. I've got the hardware down and have managed to get numerical data output ...
-2
votes
2answers
31 views

not able to resolve “a function-definition is not allowed here before '{' token ” [closed]

I, being new to Arduino started off by making a simple lcd watch which also shows the temperature. Everything was working fine untill this error came up "a function-definition is not allowed here ...
0
votes
1answer
40 views

Help with clearing memory

I got the following code from Github, and have been playing with it for the last couple months. The loop ALWAYS begins with the same LED as long as you do a complete reset to the board or power it up....
0
votes
2answers
32 views

What is the purpose of '&' while passing bool as a function parameter [closed]

If I use this function without & before change_x (in function parameter), change_x never changes to false and it keeps on printing forever. Why do I need &? void some_function(bool &...
0
votes
0answers
48 views

How to separate programming parts corresponding to different peripherals

Often I want Arduino board to control several peripherals. Writing program for all of them in one document using #define SOME_PIN 4 constructions seems pretty inconvenient to me. Especially in such a ...
0
votes
2answers
95 views

Read only one line in SD card

I have some C++ code, but I cant convert it to Arduino language. I just want to ask, what is the same as getline() (C++ code) function in Arduino? I just wanted to get the first line in my SD card... ...
2
votes
2answers
81 views

How to convert a string to long int? [closed]

I'm new to Arduino and my first project is an RFID reader. since I need a lot of known tags list , i have a problem with not enough memory. for that reason I want to convert strings like : "426d9244",...
2
votes
1answer
27 views

Why the MPU6050 gyroscope read write register value is 0x08 for a full scale of 500 degrees per second?

I am trying to connect a gyroscope MPU6050 to arduino ATmega2560 and read its raw values from its 6DOF (gyro and acc). I found the following code: //Activate the MPU-6050 Wire.beginTransmission(...
2
votes
1answer
42 views

Running code through functions [closed]

I am making a led cube where sequential lighting is used. So basically i need to repeat my commands for a given time. After much reasearch nothing turned up so decided to ask here. Here is ...
0
votes
0answers
16 views

Arduino Mega and MPU6050: Reducing the code [duplicate]

I am trying to work Arduino Mega AT2560mega and gyroscope MPU6050. There is a premade code on Arduino forums, where all registers of MPU605 are defined and the code is about 800 lines. I can't find ...
0
votes
2answers
46 views

Can client IP address be obtained from Arduino Ethernet2 library for W5500 during client.connected() call?

I've found posts explaining how to get client IP by modifying the W5100 Ethernet library and the Adafruit CC3000 library but not the Ethernet2 lib for W5500 chip, which is different enough that the ...
0
votes
1answer
40 views

How to pass 2 parameters with RCSwitch library?

I'm learning Arduino's world, but knowing very little about C and C++. I'm trying to achieve a little RF transmitter which should send the temperature and humidity from a DHT-11 sensor to a ...
0
votes
4answers
49 views

How to repeat the code

I want to make my biped robot keep walking, but it only move for twice, this biped robot project is important for my Capstone project. The code below is the code that I used #include <Servo.h> ...
0
votes
1answer
15 views

Can I use GSM and Data Logger Shield at the same time on one Arduino?

Me and my classmates are trying to make an arduino base project where we will be using sensors, GSM, and Data logger shield. We want the arduino to store the data collected and at the same time send a ...
0
votes
0answers
29 views

Reading raw values from MPU6050 using Arduino Mega

I am trying to connect Arduino Mega with a gyroscope/accelerometer with 6DOF, using MPU6050 micro ship. While searhing online, I found lots of codes with more than 200 lines, to just read raw values ...
0
votes
0answers
27 views

Lost code already loaded on Adruino Pro mini [duplicate]

Can I retrieve the code from an already programmed Adruino Pro mini 328? I have found avrdude who can make a perfect copy of the loaded firmware, but I just want to have the code back.
1
vote
2answers
82 views

Stopping a countdown timer when it hits 0 [closed]

I am trying to modify the following sketch to count down (which seems to be partially working). What do I need to modify, to get the timer to stop at zero? Right now it counts down from 10 seconds, ...
0
votes
1answer
32 views

How to upload program to custom arduino board without USB FTDI and making it read only? [duplicate]

If I was to mass produce a microcontroller board I have designed based around the atmega328 (very similar to an arduino uno) but for one embedded task where I want one program only to be stored on it. ...
1
vote
1answer
124 views

How to interface USB to custom Arduino Uno Schematic and programming atmega?

I'm fairly new to designing schematics and working with the atmega on its own and I'm designing an arduino schematic on eagle. Ive gotten to the stage where I need to incorporate a TTL USB interface ...
0
votes
2answers
142 views

How to automatically reset the nrf24l01+ with code?

I have two separate nrf24l01+ connected to two different Arduino UNOs, one as TX and the other as RX. The problem is the connection stops after a while between them. On the Arduino COM screen I have ...
0
votes
2answers
44 views

freeMemory() function from memoryfree library not returning decreased value in arduino UNO

I burned the code written below, I expect that as we declare the local variable in the loop, freeMemory() function should return decreased value. But it remains constant..! please explain why..? The ...
0
votes
1answer
18 views

MemoryFree library showing Irregular Behaviour..!

I simply burned the code written below but it is showing me irregular behaviour.. as in output's last paragraph, free memory increases after a runtime allocation, how it is possible? The output is ...
1
vote
4answers
137 views

Hex/Byte Reversing and Conversion

I'm working on an RFID system using a MFRC522 with this Library : https://github.com/miguelbalboa/rfid Here's the code I have right now: int A=(mfrc522.uid.uidByte[0]); int B=(mfrc522.uid.uidByte[1]);...
0
votes
0answers
33 views

MemoryFree library showing free memory more than capacity of Atmega328Pu MCU

I simply burned the code written below but it is showing me free memory as 2299 bytes please somebody clarify that how in an Atmega328pu can have 2299 bytes free with an overall capacity of 2048 bytes....
1
vote
1answer
25 views

Can't upload code to an Arduino LilyPad using FTDI

I've tried to upload my code to an Arduino LilyPad (328) using an FTDI basic breakout, but i get this: avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: ...
0
votes
1answer
123 views

Password.h and keypad.h change pass sketch for Arduino [closed]

I have a fixed password. If letter "D" is pressed on the keyboard and the correct password is entered, the fixed password will be then changed. This newly entered password is now the correct password, ...
1
vote
2answers
26 views

Reconstruct uint32_t from char array to RTC.set

I am currently experimenting with a Digistump ATTiny85. Since it has no Serial, I use the basic DigiUSB library for communication. The RTC library used is this one: https://github.com/JChristensen/...
0
votes
0answers
79 views

How to make use of HeatIndex and DewPoint. with BME280 library?

Modified library example using HeatIndex and DewPoint calculations; from the BME280 Library by Tyler Glenn. /* BME280 I2C Test.ino This code shows how to record data from the BME280 ...
0
votes
2answers
28 views

Can I control relays through an Arduino while using USB joystick? [closed]

I was curious if i could control maximum of 9-10 relays with an arduino while using USB joystick? Id also want to connect a camera to see what my robot is doing, so i had few ideas. 1. Try and do it ...
-2
votes
1answer
133 views

hx711 and load cell read out 0 for calibration

I'm using this tutorial from Sparkfun https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide And using THEIR code. The only difference is I added a delay so it wouldn't ...
0
votes
1answer
33 views

Fade effect analog RGB strip and NodeMCU

I have an analog or dumb RGB strip that I control with HTTP commands. I want to be able to make the strip fade between different colours when I call http://XX.X.X.XXX/fade. I want it to do this ...
0
votes
1answer
40 views

Way(s) to store an integer from the serial output and sutract it from the next Serial output

This seems so simple but I can't solve it. (I'm new to Programming) I do not want to use EEPROM. Just store it and do the math. I strip the Azmuth and Elevation values from a satellite tracker program ...
-3
votes
1answer
31 views

Coding multiple servos in Arduino [closed]

I'm a first year persuing Mechatronic engineering, and I'm having trouble with this code that I am using to control a biped robot for my project. #include <servo.h> Servo myservoa; ...
0
votes
1answer
47 views

How will I solve my problem : expected primary-expression before '>' token [closed]

// defines pins numbers const int trigPin = A0; const int echoPin = A1; // defines variables long duration; int distance; #include <moving.h> #include <Servo.h> Servo servo; moving car(...
-2
votes
1answer
45 views

a code problem for arduino GSM 1400 to send a SMS when tilt movment is detected using accelerometer [duplicate]

There is a mistake in the design implementation of the code probably in if statment - when using the serial monitor it repeatedly shows printf() statements from the code instead of "Sending SMS ...