Skip to main content

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.

135 votes
4 answers
121k views

I need to read a sensor every five minutes, but since my sketch also has other tasks to do, I cannot just delay() between the readings. There is the Blink without delay tutorial suggesting I code ...
Edgar Bonet's user avatar
  • 45.2k
21 votes
3 answers
9k views

I have no previous experience with C++ or C, but know how to program C# and am learning Arduino. I just want to organize my sketches and am quite comfortable with the Arduino language even with its ...
heltonbiker's user avatar
5 votes
1 answer
2k views

(Before you down-vote this, note that it is a "ringer" to answer a FAQ, with a self-answer.) This question comes up all the time. How do you combine 2 different sketches together? Say I have a sample ...
Duncan C's user avatar
  • 5,752
94 votes
22 answers
19k views

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++...
DLJ's user avatar
  • 1,149
64 votes
7 answers
112k views

The use of malloc() and free() seems pretty rare in the Arduino world. It is used in pure AVR C much more often, but still with caution. Is it a really bad idea to use malloc() and free() with ...
Cybergibbons's user avatar
  • 5,430
41 votes
10 answers
160k views

I have a Arduino Nano (Sainsmart) that I'm trying to upload a sketch to. Under the Arduino IDE, the device selected was Arduino Nano w/ ATmega328. However uploading the sketch gives me the error ...
Nyxynyx's user avatar
  • 1,419
9 votes
2 answers
3k views

Following on from What's the 2nd ICSP header for in Arduino Uno R3? I was wondering how this could be hacked to our advantage. For example, could that firmware be rewritten to have the UNO ...
Madivad's user avatar
  • 1,382
41 votes
10 answers
178k views

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 ...
JVarhol's user avatar
  • 1,903
4 votes
4 answers
4k views

I am programming an Arduino. In the same .ino file as setup() and loop() I have defined the following: void setup() { // setup code } enum class CYCLE { TypeA, TypeB }; String cycleToString (...
AJP's user avatar
  • 181
13 votes
4 answers
8k views

What is the best method to get a truly (as opposed to pseudo) random number in Arduino, or at least the best possible approximation? From my understanding, the function randomSeed(analogRead(x)) it's ...
Rexcirus's user avatar
  • 253
1 vote
1 answer
18k views

I am writing a class for a project which will take care of handling any LCD updates for my project. The way I want to handle this is to initialize the LCD object in my main file, and then pass the LCD ...
Alex's user avatar
  • 181
32 votes
4 answers
60k views

Arduino is an odd hybrid, where some C++ functionality is used in the embedded world—traditionally a C environment. Indeed, a lot of Arduino code is very C like though. C has traditionally used #...
Cybergibbons's user avatar
  • 5,430
7 votes
4 answers
37k views

This code compares the analog input value against two thresholds, having three voltage regions. Then it will turn on an LED according to what region the read voltage is in. The problem is that when ...
Andy's user avatar
  • 103
1 vote
2 answers
3k views

How to combine two different sensor sketches to one complete sketch for a complete circuit that attaches to one Arduino Uno? Sharp Dust Sensor int measurePin = A0; // Connect dust sensor to Arduino ...
Muhammad Lutfi's user avatar
18 votes
2 answers
27k views

In either of setup or loop, if I were to add an exit(0) call, where would control be passed to? What would the next state of the microcontroller be? Would it stop execution and power down? I am using ...
asheeshr's user avatar
  • 3,847

15 30 50 per page
1
2 3 4 5
9