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
1answer
25 views

How to have 4 Arduinos communicate with each other? [closed]

I was wondering if it was possible to connect 4 Arduinos together so that the sensors input can be received by all 4 of them either by a wired connection or a wireless connection either way it should ...
0
votes
1answer
445 views

Arduino IDE: How to get PROGMEM const length?

I have defined a byte array as a constant in the Atmel's flash memory: const uint8_t eye [] PROGMEM = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff }; How ...
0
votes
1answer
2k views

Using MMA8451 accelerometer to count steps [duplicate]

I'm trying to use an Adafruit MMA8451 accelerometer to create a pedometer-type device that counts steps. I'd like to initiate a counter that says "if the x-axis readout is > some threshold, add 1 to ...
0
votes
1answer
130 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 ...
0
votes
0answers
19 views

am working with Bluetooth HC- o5 after uploading code i get Expected unqualified -id before numeric constant, i need help am new to arduino [closed]

char Incomming_value = 0; void setup() { Serial.begin(9600); pinMode (13, OUTPUT); } void loop() { if(Serial.available() > 0) { Incoming_value = Serial.read(); ...
0
votes
1answer
49 views

128x64 and pushButtons

Could someone give me some advice related to building a menu for a 128x64 LCD using 5 pushButtons? i have 5 screens. btn1 is for display MainMenu and Selection. btn2 and btn3 is for up and down ...
-2
votes
1answer
32 views

digitalwrite was not declared in this scope [closed]

void setup() { // pinMode(13,OUTPUT); } void loop() { digitalwrite(13,LOW); delay(500); digitalwrite(13,HIGH); delay(500); } void loop() { // put your main code here, to run repeatedly: ...
0
votes
0answers
30 views

How to edit code from Node-Red to Cayenne

I am working on a project to run some (relays or LED's) on an inputs (Pins) Arduino by esp8266-01s . now while searching on internet I found a video divided it two step that talks about the issue ...
0
votes
1answer
86 views

Serial Monitor presenting backwards question marks

Thanks to anybody who can offer some guidance on this issue . I would like to quickly point out that the microcontrollers being used are OrangePip Kona 328. When I put the light on the photodiode ( ...
-2
votes
0answers
39 views

Must include empty print statement to get program to run

I have a rather large program of the following shape: loop forever while some condition run each program in list by calling the program's 'run()' function end while end loop I'm running it ...
0
votes
1answer
30 views

How to make a dynamic menu with a sub-menu ( Arduino mega or Arduino Uno)

I have an arduino mega with a LCD shield (from keyestudio KS2056). I am trying to create a menu with a submenu that would have addable and removable strings based on inputs from a RFID scanner(addable)...
0
votes
1answer
145 views

How can I interrupt a delay() when a button is pressed?

I have created a device that allows my son to track time spent on activities and exchanges that time into a time he can use with his electronics (eTime). Full code in GITHUB I am having trouble ...
0
votes
1answer
71 views

Continous running light with fading trail

In examples of FastLED library, there's the animation of a dot sweeping back and forth, with fading trails (file "DemoReel100", animation "sinelon"). How can I alter the code so instead of moving back,...
1
vote
1answer
38 views

Reduce Sketch Size Help!

I dont know what to do? Sketch uses 3712 bytes (12%) of program storage space. Maximum is 30720 bytes. Global variables use 210 bytes (10%) of dynamic memory, leaving 1838 bytes for local variables. ...
1
vote
2answers
6k views

STM8 Development Board with Arduino IDE

I got one of these cheap STM8 boards from China and was hoping to find a way to use this with arduino code. Does anyone know of an arduino boot loader and board package that works with them ?
0
votes
0answers
30 views

HX711 Arduino library creation

I'm trying to create my own library for HX711. In that, I created a .h file and a .cpp file. There are some issues in my program. Please tell me what the error in the code is. hx711adc.h file-> #...
36
votes
9answers
141k views

Programming an Arduino using Python, rather than C/C++

I am not very skilled with the C Language and I was wondering if there is a way in which python could be used to program an Arduino. This would most likely require a different IDE in order to be able ...
1
vote
1answer
53 views

I want turn the led off only when the input is low for a prolonged period of time and not when there are ups and downs in sound signal [closed]

My project is baby cry detection,when the baby cries the led must turn on and when it stops it should turn off, but I want it to turn off only when the baby has stopped crying , not when there are ups ...
0
votes
1answer
67 views

Can someone check my code? My Arduino isn't doing a consistent count cycle

I'm wondering if someone could have a look at my code and let me know if there's something wrong with it. I had the code done for me a while back and did a quick test and it seemed to work. I have now ...
-1
votes
1answer
31 views

SD card initialisation failed or not present Error [closed]

I am using Arduino Mega, SD card module and FAT32 micro SD card. I can not read files from the SD card. Every time it says SD card initialization failed or not present. I am using the standard Arduino ...
0
votes
4answers
7k views

While loop not breaking

I'm trying to build a circuit that buzzes until a button is pressed, or it buzzes 5 times: void alarm() { int AlarmState = 0; //Just to get while loop going int count = 1; while(AlarmState==0) ...
1
vote
1answer
3k views

Why is the loop() stopping?

I would like to move my servo motor (SM-S2309S) between random angles. In order to do so, I used this simple code: #include <Servo.h> Servo servoMain; // Define our Servo // SM-S2309S angular ...
0
votes
1answer
214 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.
0
votes
2answers
39 views

Is possible use Macro F() with Integer and Other types of variable?

i have a sketch that is using very memory RAM of my Atmega2560 (is a giant project), and i need use various "println" because i have a TFT screen and i need to show data on the screen to user see. So, ...
0
votes
1answer
15 views

L298N Motor Driver - Code issuing “expected primary-expression before '=' token”

Programming Questions / L298N Driver - Code Issuing - " expected primary-expression before '=' token" Today at 07:20 pm Hello Arduino Community, Code is shown at bottom - please read below I've been ...
0
votes
0answers
19 views

Atmega168A won't be programmed via USB (Minicore) [duplicate]

I have designed a custom board based on a Atmega168A and a MCP2221 for the USB bridge. I successfully programmed the Atmega168A with an Arduino as ICSP with the following sketch (Minicore Atmega core):...
0
votes
1answer
63 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 ...
-1
votes
2answers
38 views

Is it possible to get values only during vibration/movement from an Accelerometer(ADXL335/MPU6050)?

I'm trying to make a wearable motion sensor using ESP32 board and ADXL335 Accelerometer. Presently when I'm serial printing the output I'm getting the tilt value as well, which have different values ...
0
votes
2answers
41 views

Declaring and using array of structures in Arduino

Printing structure variables, I get default values. What is wrong with my code? struct SCENARIO { int Lamp_Pin = -1; int PB_Pin = -1; } ; SCENARIO _red; SCENARIO _yellow; SCENARIO _white; ...
0
votes
1answer
165 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

Pseudo-code of a program

I have written a code but I am facing a problem in pseudo-code that I am not able to change this code, so can anyone help me in translating the Arduino IDE program code to pseudo-code? #define ...
0
votes
2answers
42 views

Set slide potentiometer values

I am using the Grove - Slide Potentiometer (http://wiki.seeedstudio.com/Grove-Slide_Potentiometer). How can I set the potValue so that at maximum it will 128? int potPin= A0; int readValue; int ...
0
votes
3answers
310 views

Esp8266 Vin pin

I've read that Vin pin is directly connected to usb cable in esp8266 (which is 5V). I wonder if I can power a relay 5V and a servo motor Sg90 with this pin? And is there any danger of doing that ?
10
votes
3answers
3k views

Could someone explain this weird looking code, used to setup timers?

While looking at sketches other people have written, I occasionally come across code that looks somewhat like this: TCCR1A = 0; TCCR1B = 0; TCNT1 = 34286; TCCR1B |= (1 << CS12); TIMSK1 |= (1 &...
-1
votes
5answers
53k views

Can I make multiple void loops with Arduino Uno?

I have a problem. I want to make a car with a motor, front lights and rear lights. I want to run them at the same time but in different loops. This is my code. const int red1 = 10; const int red2 = ...
0
votes
1answer
87 views

How to use H3LIS331DL 3-Axis Linear Accelerometer with arduino to detect Harsh braking of vehicle

I am a newbie here, Recently I was working with H3LIS331DL 3-Axis Linear Accelerometer I²C Mini Module Here is code for the X, Y, Z-axis. #include <movingAvg.h> #include <...
0
votes
0answers
26 views

Help with tachometer programme

This is my first programme, which is to control a brushless ESC motor and an IR sensor to read the props' RPM. However I can't seem to figure out why it's not working. The reading keeps giving me 0, ...
0
votes
2answers
66 views

How to exit while loop using keypad?

I can't seem to be able to escape a while loop using a keypad button. I've tried the solution from this thread: https://forum.arduino.cc/index.php?topic=79932.0 Here's my code: void alarm(){ char ...
-2
votes
1answer
34 views

Is it permissible to use strlcpy to copy an array to itself? [closed]

Task: delete "\n" at the beginning of the array. Example: char s_msg[15] = "\nHello world!"; void setup() { Serial.begin(115200); Serial.println("Load"); // Search \n if(strstr(s_msg, "\n") ...
0
votes
1answer
71 views

Connecting an Arduino Nano to a Raspberry Pi Zero

I'm working with an Arduino Nano Every, and I'm trying to connect it to the Raspberry Pi Zero for data collection from I2C sensors and writing/program code from the Pi to the Arduino. Typically, I ...
2
votes
2answers
315 views

Multiple Time-Sensitive Tasks

I'm using an Arduino Leonardo and need to perform two time-sensitive tasks like this: // Task 1 - Gets executed once a second (1Hz) // Execution of task needs approx 70ms task1(); //Sending a ...
0
votes
1answer
47 views

I´m trying to make a kind of videogame with Arduino UNO

it´s a school project, but I'm having some problems to create a menu selection. In the LCD, all the character are overwriting, I'm a beginer, so i dont have any idea of what i was doing wrong (ps.: ...
0
votes
1answer
146 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, ...
0
votes
1answer
70 views

led chaser fill color effect

Please help. I am learning a lot about Arduino. Most all in lightning. I am a newbie. I play with nano and LED ws2812 and use fastled library. What ask is to make effect like fill effect. For ...
1
vote
1answer
817 views

cast double to long leads to unexpected results

I wrote a little program to show my problem: void setup() { Serial.begin(9600); double K=39.85; double a=K*100; Serial.print("a= "); Serial.println(a); long val_long = 0; val_long = ...
0
votes
2answers
30 views

default parameter class method

I have this function (which works fine): String Esper::rtcTimeString() { DateTime now = rtc.now(); char buf[] = "MM/DD/YY hh:mm:ss"; return now.toString(buf); } I'd like to have a default ...
0
votes
4answers
48 views

String to float on Arduino

I'm trying to convert a String to a float but I'm running into issues with precision, even with the Arduino's own String example I'm getting bad results. Example 0: Input string: 1.234567 After ...
-1
votes
1answer
25 views

Arduino recorder with SD card module

Can any one suggest me best device in cheap rates to record audio in to SD-card and vice versa from the speaker......i want to record audio into the sd card like as feedback from customer
0
votes
1answer
42 views

Use JYETech 2.4 Inch LCD Display Screen Module with Arduino?

I have this JYETech 2.4 Inch LCD Display Screen Module that I would like to use for a project I have in mind, however, I'm not sure how to wire it up with my Arudino Mega. Here is the datasheet for ...
0
votes
1answer
43 views

I need some help getting data from a rangefinder

I have wired up my range finder (CJVL53L0XV2) to a breadboard for testing and have run the arduino example code for the rangefinder. The rangefinder works, but I do not know how to take the distance ...

1 2 3 4 5 28