Most Popular
1500 questions
8
votes
3 answers
Arduino screws up trivial program involving enum
Behold this insanity:
enum WhatArduinoIs {
Easy, But, Insane, Obsolete, And, Far, Worse, Than, mBed
};
void TellMe(WhatArduinoIs pls) { }
void setup() { }
void loop() { }
I'm pretty good at C++, so I'm fairly sure that should compile. However I…
Timmmm
- 183
- 2
- 5
8
votes
1 answer
Can I program a 3.3v chip on a 5v board?
I bought a Gertboard a while ago, and one of the features it has on-board is an ATMega328 (DIP). However, since the Gertboard is designed for use with the Raspberry Pi, it only operates at 3.3v, so the clock speed is limited to ~12MHz.
Programming…
Peter Bloomfield
- 10,972
- 9
- 48
- 87
8
votes
4 answers
What are the traditional ways to optimize program memory usage?
While doing big projects using Arduino boards (Uno, Atmega328P MCU). I used to get warnings like this
Sketch uses 13764 bytes (44%) of program storage space. Maximum is 30720 bytes.
Global variables use 1681 bytes (82%) of dynamic memory, leaving…
Mayoogh Girish
- 205
- 2
- 7
8
votes
1 answer
Is there a way to detect if Arduino, Stino or another IDE/toolchain is in use?
I've noticed some irritating differences between the Arduino IDE and Stino (mainly around including certain header files). These are likely bugs that need following up with one or both of the parties, but in the meantime, I would like my code to…
Cybergibbons
- 5,420
- 7
- 34
- 51
8
votes
1 answer
Digital RGB LED animation
I've been trying to get colours fade into each other for a project I'm working on.
I have achieved this with the rainbow effect that some from Adafruit's example code, however I want to be able to choose the colours (eg. dark blue into light…
Rhys Edwards
- 183
- 1
- 4
8
votes
3 answers
Using more than one Ping Ultrasonic Range Finder
I have done various applications with the Ultrasonic example project but it is always using one pinger. I'd like to make a scanner resting on a servo sweep but to reduce sweep time use more than one censor.
the documentation is rather basic ping…
alexmac
8
votes
2 answers
Audio Frequency White Noise generation using Arduino Mini Pro
For DIY, how to program Arduino Mini Pro to act as an Audio Frequency White Noise generator?
Presumably,
a) using one Digital Output pin
b) feed to a simple passive RC low pass filter to reduce out of band signal
c) feed to a simple class-D IC…
EEd
- 904
- 1
- 13
- 21
8
votes
2 answers
What is the default setting for a digital output pin
With digitalWrite(pin_number,value), we can set an output pin as HIGH or LOW. But if only coding pinMode (pin_number, OUTPUT), what is the default state for the pin pin_number, LOW or HIGH? It is noted that: Pins configured as OUTPUT with pinMode()…
jingweimo
- 201
- 1
- 2
- 5
8
votes
2 answers
Temperature sensors TMP36 and LM35 have temperature diff. (offset) in the same circuit
I am trying to use the two temperature sensors TMP36 (from Sparkfun Inventor's kit) and KEYES LM35.
In read TMP36 Sensor and I convert the result to Celsius using the following code:
// TMP36 input sensor -> degrees Celsius calculation
TM36reading =…
ggia
- 95
- 1
- 2
- 7
8
votes
3 answers
Why is 'n' parameter of snprintf ignored?
I have found that the n parameter of snprintf() seems to be ignored in my code.
char asdf[10];
Serial1.println(snprintf(asdf, 2, "hello"));
This prints 5 when I would expect it to print 2. What is happening?
Westin
- 83
- 4
8
votes
2 answers
How to choose alternate I2C pins on ESP32?
I'm a begginer with Arduino and this may be a basic question but I'm facing an issue.
I'm using a HTU21D sensor with an ESP32. This sensor use I2C communication. Inside the Arduino library, there is this function to start to collect data:
//Start…
Gazouu
- 273
- 2
- 4
- 10
8
votes
3 answers
Arduino IDE Permision Denied For Upload, Ubuntu
I am having issues uploading to my Arduino from the IDE on Ubuntu 18.04. The error message I have received is:
Arduino: 1.6.10 (Linux), Board: "Arduino/Genuino Uno"
avrdude: ser_open(): can't open device "/dev/ttyUSB0": Permission denied
I have…
Neal
- 81
- 1
- 1
- 3
8
votes
2 answers
How do I (easily) power a 5 V 3-pin fan?
I have a 5 V 3-pin fan. I want to be able to:
power it from an Arduino Uno or a Seeeduino Lotus board, and, ideally;
be able to change its speed.
Most resources I can find on the web explain how to connect a standard 12 V fan and moreover…
Arseni Mourzenko
- 234
- 1
- 3
- 10
8
votes
3 answers
How to stop Arduino from drawing power through USB
I'm working on an embedded project, where I use arduinos as a "sensor shield" for RaspberryPi (I have model B).
The problem is, that the RaspberryPi's USB port is not powerfull enough to drive WiFi adapter and arduino with sensors. The solution is…
jnovacho
- 235
- 1
- 3
- 7
8
votes
1 answer
Is it better to use c_str or toCharArray?
When reading/trying a recent answer, I was surprised to see that Arduino's String class supports the c_str() method, just like the C++ std::string class. As expected, it appears to get a pointer to the string's contents as a null-terminated char…
Peter Bloomfield
- 10,972
- 9
- 48
- 87