12 votes
Accepted

delay(time); vs if(millis()-previous>time); and drift

There's one important thing that you need to remember when working with time on an Arudino of any form: Every operation takes time. Your foo() function will take an amount of time. What that time is,...
  • 104k
11 votes

Newbie Using Brown Out detector on Arduino Due for saving variables to eeprom?

Not a good idea - if the power goes down when you writing to EEPROM, your EEPROM data will be corrupted. The brown-out detector goal is to shut off the MCU, before it goes mad due to low power voltage....
  • 528
9 votes

Sizeof variables and Due's RAM

sizeof doesn't return the number of elements. It returns the number of bytes. Since they are uint16_t arrays each element is 2 bytes - hence twice the size. The reason your last number is only 40928 ...
  • 104k
8 votes
Accepted

Faster Arduino Mega

You should begin working with 3.3V. 5V is getting rarer and rarer as far as "real world" applications go. Many devices that you have been using at 5V will also work at 3.3V (such as the MAX22500E). ...
  • 104k
7 votes
Accepted

SAM3X8E (Arduino Due) Pin IO registers

If you have a read of section 31 of the Datasheet, available from here, things may come a little clearer for you. Here's a summary of what I know: PIO stands for Parallel Input/Output and offers the ...
7 votes
Accepted

Read OUTPUT pin value in Arduino Due

That method only works on AVR based systems. It exploits a "feature" whereby the IO pin, when in OUTPUT mode, is also in INPUT mode at the same time, and reading the pin reads the value that the pin ...
  • 104k
6 votes

Only getting error from ESP8266 AT commands

The AT firmware responded with ERROR because it received data, but timed out waiting for the CR/LF line ending. AT commands must be terminated with Carriage Return '\r' and Line Feed '\n' control ...
  • 17k
6 votes
Accepted

Memory allocation on Arduino Due never returns NULL

Why This is a partial answer, for now, mostly with regard to: Why does malloc() never return NULL? So, the Due appears to use Newlib as its libc implementation; that is the systems C (standard and ...
  • 4,611
5 votes

High Frequency Sine Wave Generation

To generate a square wave, you only need to update the output at a rate of two points per cycle. (Technically, when the Arduino's PWM output is configured for 50% duty cycle, that's a square wave at ...
  • 450
5 votes

Arduino Time Clock Accuracy

Re-visiting an old question... as I found a very informative blog post that sheds new light into it. But let me first provide some context before giving the link. When assessing the quality of a time ...
  • 39.3k
5 votes
Accepted

Simple LED circuit is not working

What connects the resistor to the LED? Absolutely nothing. It's hard to work out which holes the LED is plugged into, but I think your current circuit looks something like this: You need to connect ...
  • 104k
5 votes

Arduino is not responding to a Tiny RTC I2C modules, How to fix?

You have a couple of problems (although the lack of pull-up resistors is not one of them, because the board you linked has pull-up resistors on it). The DS1307 needs to operate at a minimum of 4.5 ...
  • 35.7k
5 votes
Accepted

How do I read from /dev/ttyACM0 in Linux without a terminal emulator?

I have had very similar problems with my yun(shields) and I found the stty command to be very crucial for a good working. I use following command and it works with mega and due on the yun stty -F ${...
  • 1,372
5 votes
Accepted

Arduino Due vs Mega 2560

The 'R3' version boards and shields are compatible with 3.3V and 5V. For example the Ethernet Shield V1 version 'R3' can be used with the Due. The new Arduino Ethernet Shield 2 is also compatible with ...
  • 3,145
5 votes
Accepted

How to enable exception handling on the Arduino Due?

First, we must make sure the "-fno-exceptions" compiler flag is overwritten with "-fexceptions". In addition, we must link a separate library that includes the compiler support ...
  • 1,184
4 votes
Accepted

Connecting battery and LED to Arduino Due

What you want is something like this (ignore the fact that my mini breadboard is stuck to a shield): My starter Arduino kit came with the connector for the 9 volt battery into the power socket on the ...
4 votes

Can't drive long NeoPixel strips with Due or Duemilanove?

Your Duemilanove only has 1k of RAM. That's not much. Each pixel takes 3 bytes of RAM (R/G/B). So (say) 60 pixels would be 180 bytes. That's less than 1k, but there would be other uses of RAM in your ...
  • 35.7k
4 votes
Accepted

Can I Implement a PLL on an Arduino?

A PLL is a very complex device which is not something that can easily be created purely in code. Many microcontrollers include a PLL as part of their oscillator systemm which allows them to run ...
  • 104k
4 votes

Arduino due slow clock

The slow clockr is primarily used for the real time clock (RTC) module inside the SAM3X chip. It can also be routed to other places when you want a low speed clock source, but the only places it is ...
  • 104k
4 votes

Are DAC pins useful for anything besides working with audio?

They are incredibly useful. They are essentially how you deal with the analog world. For example, I'm using two of them in a project here that uses a frequency generator and a couple of op-amps to ...
4 votes
Accepted

Arduino Due: Interrupt-based ADC hangs processing

In your interrupt handler, ADC_Handler(), you set sample_buffer_full when the buffer is full. I don't see anywhere in the code where sample_buffer_full ever gets reset (cleared) once it's been set. ...
4 votes
Accepted

Simultaneously reading data from multiple serial ports

My question here is how can I simultaneously read out all the data from the different serial ports on the arduino mega sketch. As you are using several serial ports data can already be received ...
  • 7,919
4 votes

Arduino onboard LED pin number as a constant

Try LED_BUILTIN: pins_arduino.h:static const uint8_t LED_BUILTIN = 13;
  • 104k
4 votes
Accepted

Arduino onboard LED pin number as a constant

#define LED_BUILTIN 13 (source)
  • 11.2k
4 votes
Accepted

Programming Arduino in Pascal?

Not Pascal, but Ada, which is much less restrictive than Pascal while enjoying the same advantages over low-level programming, and much more actively supported with language revisions as recently as ...
4 votes

Arduino Due vs Mega 2560

The Due can do a lot of things much faster. It has more memory and far more processing power. It has more flexible and more powerful built-in peripherals. It can't easily interface with 5V devices ...
  • 104k
4 votes
Accepted

fatal error: avr/io.h: No such file or directory

The Due is SAM architecture. avr/io.h is specific to the AVR architecture of the Uno's microcontroller. The compiler will not look in the avr tools folder for that file and even if it did it wouldn't ...
  • 3,906
4 votes

Sizeof variables and Due's RAM

The sizeof operator's result is number of bytes, not number of array elements. Your arrays in the program above have two bytes per element, hence twice as many bytes as elements. If you want to ...
4 votes
Accepted

L and ON keeps blinking

You should split your problem in pieces. Like you cannot get communication with your Arduino again, so check first: If you plug in the Arduino / USB, do you get a message on your computer? Is it ...
4 votes

How to connect Arduino 5v pin with multiple things?

The simplest way is to just use a breadboard to connect your devices to your Arduino: I can't read Chinese, so I can't check the specifications of these particular devices, but you need to be aware ...
  • 1,033

Only top scored, non community-wiki answers of a minimum length are eligible