Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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

WS2812 Stair lighting - not all LEDS lighting up

I'm doing a Arduino based stair light project and have a little problem with the code. I have used Simon Jowett's code from the instructable website which after a couple of tweaks works perfect. Apart ...
0
votes
0answers
25 views

ARDUINO + SIM808 POST ERROR 400 BAD REQUEST

Please, I need help with debugging communications through a SIM808 Device I'm using alongside an Arduino Uno R3 as a prototype for a tracking device. The sketch is provided below. #include <...
0
votes
0answers
33 views

Arduino car that solve any maze [on hold]

this is my code for Arduino car solving any maze but car using this code don't solve any maze can you find what is the problem with it ? #include <Servo.h> Servo myservo; // set myservo int ...
0
votes
1answer
29 views

Is it possible to run two small motors off an Arduino and have the motors move separately based on a random number generator?

I am a 2nd year design engineering student working on a design project where we are tasked with automating the movement of a rainfall simulator. One of our design ideas consists of two small motors ...
36
votes
9answers
132k 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 ...
0
votes
1answer
18 views

What kind of data type can be use store a binary bit-stream which is more than 64-bits?

I'm wondering if one needs to assign a bit-stream of 78 bits to a variable(later on to be processed), what datatype can be used? What is the max bit can be stored into a variable in C?
1
vote
1answer
41 views

How to split a binary data to form two split binary data?

I want to split a received binary data into two binary data. Take the following received binary data for instance: uint32_t data = 0xFFFF0001; In binary format it is: ...
0
votes
2answers
55 views

while(1) inside if conditional

if (!MDNS.begin("esp8266")) { Serial.println("Error setting up MDNS responder!"); while (1) { delay(1000); } } I know this will result in an infinite loop if the if conditional is ...
2
votes
2answers
5k views

Since double and float represent the same data type (usually), which is preferable?

It looks like on ATMega based boards, float and double are equivalent 32-bit (4-byte) data types. However, on the Arduino Due, doubles are 64-bit (8-byte) where floats are 32-bit (4-byte), same as ...
87
votes
21answers
15k views

What are the other IDEs for Arduino?

The basic Arduino IDE lacks a lot of the sophistication present in other IDEs such as code completion, code collapsing, folder organisation, etc. Are there other IDEs that allow programming in C or C++...
0
votes
2answers
35 views

How to use ATtiny pins that are usually 'reserved' for chip programming?

How to program an ATtiny45 to use the pins 1, 5, 6, 7 (i.e. PB5, PB0, PB1, PB2) as input or output? pinMode(5, OUTPUT); pinMode(0, OUTPUT); pinMode(1, INPUT); pinMode(2, INPUT); digitalWrite(5, HIGH);...
1
vote
1answer
25 views

cant figure out how to fix this compile error

evrything worked for a bit and changed to much to get it working again. dont really understand the error. [![C:\Users\bavob\AppData\Local\Temp\ccyfrkaL.ltrans0.ltrans.o: In function `loop': C:\Users\...
0
votes
2answers
36 views

Help with Stair Lighting using HC-SR04 sensor and WS2812 LED Strip

Excuse my naivete in this as I am very new to Arduino and the programming of. I am trying to put together a project for stair lighting triggered by a ultrasonic sensor at the bottom of the stairs and ...
0
votes
1answer
49 views

DS3231 + button to trigger light

please can someone help me with code, i want to have automatic trigger on specific hour, also i want to have button switch if needed, in my code i can press the button to trigger light relay, but my ...
0
votes
1answer
36 views

Creating an array with the length coming from a library

When creating an array like in the sketch #include <Lib.h> int myArray[Lib::len]; void setup() {} void loop() {} the variable len must be an integer constant that is known at compile time. ...
0
votes
0answers
10 views

nodemcu nack error bh1750

I am trying to run a simple example of bh1750 on my nodemcu, code is #include <Wire.h> #include <BH1750.h> */ BH1750 lightMeter(0x23); void setup(){ Serial.begin(9600); Wire.begin(...
0
votes
1answer
30 views

Error: invalid application of 'sizeof' to incomplete type 'int []' when trying to compute the size of an array in a library

I have created a library that contains an array. This is the .h file: class Lib { public: static int arr[]; }; And this is the .cpp file: #include "Lib.h" int Lib::arr[] = {0, 1, 2, 3}; ...
9
votes
3answers
3k views

How to write makefile-compatible sketches?

I'd like to write my sketches so that I can either build/upload them using the Arduino IDE, or optionally using GCC and a makefile. I know about including the function declarations at the top, but is ...
0
votes
1answer
18 views

Arduino - Extracting Multiple Strings from Serial Read

I am trying to write an Arduino code that reads a long string, example <11,22,33>, through the Serial Monitor and then stores the 11,22, and 33 into separate bins of a matrix array. So the user ...
10
votes
2answers
6k views

Will a .ino Arduino Sketch compile directly on GCC-AVR?

Okay, we all have seen those questions all over the web such as Arduino v.s. C++, or other similar questions. And a vast majority of the answers do not even touch compilation differences other than ...
0
votes
1answer
92 views

using references to SFRs in gcc inline assembler

I want to write a driver that can use either timer0 or timer2, based on a choice made at compile time. So I want all references to timer registers to be abstracted, e.g. OCRA for OCR0A/OCR2A, etc. I ...
0
votes
1answer
38 views

Help with arduino code

Thank you for seeing my post. I am trying to write a code that lets "A" displayed on row 1 and row 0 alternately on the LCD. starting from (0,1) then (1,0) then (2,1), then (3,0) etc.. when it ...
1
vote
1answer
210 views

Printing elements of char array from PROGMEM

Given: const char* PROGMEM names[] = {"Foo","Bar"}; Serial.print(names[0]); I get garbage output. Is there some function that will print the string from PROGMEM? E.G.: Serial.print(<function ...
1
vote
2answers
7k views

Global variables use to much space in the dynamic memory

I use two simple libraries (see 1, 2) I found online for my code on the Arduino Uno, unfortunately I also use ROS and all those libraries take away to much space, when I compile my code I get this ...
2
votes
1answer
122 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 ...
1
vote
4answers
36k views

Print string and integer LCD

How do I print a string and integer on an LCD? Here is what I have tried: int number = 2; int result = (number + number); lcd.print(number, DEC + " plus " + number, DEC + " equals " + result, DEC); ...
0
votes
1answer
64 views

LED blinking issue

i made a distance measuring circuit with different led for different distance ranges #define trigPin 13 #define echoPin 12 #define BPin 7 #define piezoPin 9 #define RPin 4 #define GPin 8 void setup(...
0
votes
2answers
1k views

LED Blinking Using Push button

Whenever I upload the following program I am getting error message showing "expected initializer before interval". Kindly Help me to solve out this probleme. const byte button=2; const byte LED=10; ...
0
votes
1answer
33 views

Is if statement correct?

if(temperature < baselineTemp)else{ digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); }else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){ ...
0
votes
0answers
11 views

How to solve MPU9250 overflow problems? [migrated]

I'm now working with mpu9250 for my master thesis, but I'm quite new to hardware device. My goal is to collect the data at the sample rate and postprocess these data via allan deviation. So I just ...
0
votes
1answer
36 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
0answers
33 views

Arduino Due: Measuring the time between pulses

I have a 'pulse train' generated from a photo interrupter and slotted disc mounted on a rotating shaft. My goal is to measure the time between each rising edge. I have looked at the data sheet for ...
-1
votes
1answer
44 views

Program for counting days

I need a program to count days, from day 1 to day 21 for my project. I'm making an artificial incubator and I need to show the days on an LCD.
-1
votes
0answers
38 views

Robot code is not running properly [duplicate]

I have an obstacle avoidance program that came on my robot (Elegoo uno R3 smart car) and all I've added to it is the remote program but for some reason that code only works for one time. what i mean ...
0
votes
2answers
96 views

Yet another basic and silly question about C++ strings

I made a sketch like this: void setup() { // put your setup code here, to run once: Serial.begin(9600); char str1[64] = "test with spaces"; char str2[32] = "test with spaces"; Serial....
1
vote
2answers
2k views

Arduino OTA port not updating in Arduino IDE

The OTA (from the ArduinoOTA library) on my ESP8266 does not show up in the programming ports on the Arduino IDE unless I restart the IDE. Even when I plug in a usb cable and the ports list updates ...
-1
votes
1answer
117 views

Programming question for Time Arduino

Can you program a sketch so that if the time is between 1m and 10m then it will reset itself? Reset I found already, it is the if that I don't know.
0
votes
1answer
56 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 ...
1
vote
1answer
55 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

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 ...
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 ...
4
votes
2answers
973 views

How can an Arduino Mega 2560+Wifi Shield 2.0 (SeeedStudio) receive data from database in a XAMPP server on my PC?

I'm trying to connect my Arduino Mega via Wifi to my XAMPP server. My main objective is get a value from my database and store it on a variable in Arduino code. With this new variable I'll be able to ...
0
votes
3answers
86 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 ...
4
votes
2answers
30k views

How do I split a number into individual digits?

How would I split part1 into 2-3 digits and put them into num1, num2, and num3? int FMSTATION = 10250; int update_display() { int fm_station = FMSTATION ; int part1; int part2; part1 = (...
1
vote
3answers
6k views

rfid_default_keys check with RC522

I just received a RC522 board and since i am new to RFID, I tried out some examples from "Arduino RFID Library for MFRC522". Here's one of them rfid_default_keys /* * -------------------------------...
0
votes
0answers
26 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 ...
-1
votes
1answer
44 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
2answers
409 views

Using the YS-IRTM with an Arduino Uno

Picked up a YS-IRTM IR Transmitter/Receiver module to do some testing for a project. There's not a lot of details on it but eventually came across two very important sources: Translated Module ...
0
votes
1answer
71 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
43 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 ...