Most Popular

1500 questions
10
votes
2 answers

How does this code line detect if a serial interface is connected?

I am working with some code for remote temperature sensor nodes. They turn the debug interface on and off depending on if anything is conneced to the serial port or not. The code is on Github here. Line 111 is the line of interest: if (Serial) debug…
Cybergibbons
  • 5,350
  • 7
  • 33
  • 51
10
votes
3 answers

Convert to and from Unix Timestamp

What is the best way to convert between date, hours, min, seconds to Unix timestamp in milliseconds in Arduino? I need to have this conversion, since I'm using RTC (date, hours, min, secs etc) and communicating Unix timestamp over BLE I found some…
Dzung Nguyen
  • 417
  • 1
  • 7
  • 17
10
votes
5 answers

Why is my real time clock getting the wrong time from my PC?

I want my real-time clock to set its time as the time on my PC. However, when I run the following sketch, the real-time clock reports the time as being 32-33 seconds earlier than my PC says the time is. #include #include…
lunafish
  • 101
  • 1
  • 1
  • 4
10
votes
1 answer

Controlling water temperature accurately

I have following setup: Arduino Duemilanove Small water heater connected with optical relay (PWM is ok) Waterproof DS18B20 temperature sensor Unknown amount of water (but temperature sensor and heater are always underwater). How can I accurately…
Olli
  • 265
  • 2
  • 10
10
votes
4 answers

Arduino compatible's serial port not showing Mac OSX

I bought an Arduino-compatible Freaduino board atmega8 (I selected the board type as Arduino ng or older atmega8). I installed the Arduino IDE on Mac OS X and the FTDI drivers. But my serial port looks like this when I connect the board: And when I…
Rajath
  • 225
  • 1
  • 4
  • 10
10
votes
4 answers

Arduino Nano not responding with yellow led blinking fast

Update: I started playing with a genuine Deumilanove and exactly same problem happened to it - d13 led blinking, but avrdude says stk500_recv(): programmer is not responding I uploaded a largish sketch ~15kb to Arduino Nano v3.0 (clone) and that…
Boycott Russia
  • 311
  • 1
  • 2
  • 9
10
votes
3 answers

Digital Read Serial tutorial - calculating the resistor value

The Arduino Digital Read Serial tutorial guides you through the wiring of a simple button. My questions are centered around the resistor. Why is the resistor necessary? I think I understand this, but correct me if I am wrong. To ensure that the…
Rip Leeb
  • 377
  • 1
  • 10
10
votes
2 answers

Why is int only 2 bytes?

When using C/C++ on other platforms, the int type is typically 4 bytes (or potentially more). However, on Arduino, it's only 2 bytes. Why is it different? Does it affect performance if I always use the 4 byte long instead?
Peter Bloomfield
  • 10,932
  • 9
  • 47
  • 87
10
votes
2 answers

Is there a non-float alternative to pow()?

I've scoured the LANGUAGE REFERENCE in the Arduino web-site, and I can't find a non-Float equivalent to pow() I've got to be missing something big, but for the life of me, I'm stumped! I found pow() in the FUNCTIONS column under the Math heading…
user16841
10
votes
2 answers

Does the Arduino Uno have two crystals?

Take a look at this picture: I think most of use agree that the "big silvery" thing on the board (red) is the famous 16 MHz crystal of the Arduino. That's what I've believed until very recently. I was bored so I looked at my Arduino Uno, and saw…
Dat Ha
  • 2,913
  • 6
  • 23
  • 45
10
votes
1 answer

int VS uint8_t VS uint16_t

This question is quite clear. What are the differences between an int, an uint8_t, and an uint16_t. I know it has to do with bytes and memory but can someone clarify me a bit? Things I want to know: 1- How much memory does each take. 2- When to use…
Dat Ha
  • 2,913
  • 6
  • 23
  • 45
10
votes
5 answers

How to I make the Tx and Rx pins on an ESP-8266-01 into GPIO pins?

When programming an ESP-01 with Arduino IDE, how can I make the Tx and Rx into a generic I/O pins reliably? I think there's a command to swap the Tx and Tx with other pins. I tried serial.swap() but it didn't work. So how to get done with Arduino…
vzxc
  • 101
  • 1
  • 1
  • 4
10
votes
5 answers

How to expand program memory on an arduino?

Sometimes I run out of space of the program size for the embedded C program that I want to put on an arduino. So what chip do I need to expand the program memory of the arduino so that I can use bigger C programs with my arduino?
RS2322016
  • 384
  • 1
  • 3
  • 12
10
votes
4 answers

What is the work of pulseIn?

I have code for an ultrasonic sensor which I found from a site. Here is the code: #define trigPin 12 #define echoPin 13 void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); } void loop() { int duration,…
shajib0o
  • 531
  • 2
  • 5
  • 9
10
votes
3 answers

Custom Arduino board beeps and process freezes while I'm uploading a sketch to it. Why?

The strangest thing is happening to a standalone Arduino board that I designed and built. The board (whose schematics are below) has the following features: It has a ATmega328P with a 5V voltage regulator and usual circuitry when set up as a…
Ricardo
  • 3,370
  • 2
  • 24
  • 53