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.

2
votes
1answer
45 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....
-2
votes
0answers
31 views

Create a program light.c which converts the sensor node into a light detection device - Contiki - Cooja -1 [closed]

This is my program , some instructions are in french I translate them : SOMBRE,Aucun LED allumé = dark, no LED on claire,Un seul LED allumé = clear, only one LED on Moyenne,Deux LED allumés = ...
-1
votes
0answers
21 views

Create a program light.c which converts the sensor node into a light detection device - Contiki - Cooja [closed]

is there anybody who can help me to realize this program below !? Create a program called light .c which converts the sensor node into a light detection device. the light intensity must be classified ...
0
votes
2answers
22 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
55 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
0answers
56 views

Arduino Due: Low Level Programming - The Fundamentals

I've recently bought an Arduino Due to experiment with ARM processors. I am going to be doing embedded systems in university soon and I want to get first hand experience with programming an ARM CPU at ...
0
votes
1answer
15 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
72 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
votes
0answers
37 views

Porting the FastNoise c++ library to Arduino Due [duplicate]

I'd like to use the FastNoise c++ library (github.com/Auburns/FastNoise). As I've been told, it needs to be ported to Arduino (Due). I've included the random library, which solved most error messages, ...
1
vote
3answers
70 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
23 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
31 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
83 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
116 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
33 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
22 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
43 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
58 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
22 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
47 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
28 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
55 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
44 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
17 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
39 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
51 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(...
1
vote
2answers
75 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
76 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
84 views

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

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 program ...
0
votes
1answer
49 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
48 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
148 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
1answer
65 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
39 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
44 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
31 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
56 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
144 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
50 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
41 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
36 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
230 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
151 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
49 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
44 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 ...
1
vote
2answers
103 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 ...