10

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, we cannot say. The most reliable way of dealing with time is to only rely on the time for triggering, not for working out when the next triggering should be....


9

Your first snippet is the correct solution. pinMode(pinnumber,OUTPUT) digitalWrite(pinnumber,LOW) Be careful though, you can only sink up to 6mA or 9mA per pin (as per the documentation ["Input and Output" section], I never tried more). If you need more current, use a transistor (this looks like a good example, you just need to invert the output pin to ...


9

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 is because of integer wraparound. You only provide a 16-bit unsigned variable to store it in, so all you get is the lower 16 bits of the answer. 92000 + 40000 +...


8

For a 5V logic output to a 3V3 logic input, you can use a resistive divider to lower the voltage. When unloaded, a 3V3 logic output is just enough to drive a 5V logic input. Check the AVR datasheet for the exact voltages (0.6 × Vcc = 3V, found under DC Characteristics in the datasheet). In other words, with a little bit of special care it may just work. To ...


8

The limitations of accuracy of the library depend on accuracy of the crystal. When they make, or cook, the crystal they can only make it to a certain degree accurate, also the environment of the crystal (temperature, humidity, etc.) play a role in the accuracy of it. Let's say you have a crystal that is off by .5 second every hour, great for short term, but ...


7

Search for male-male jumper wire. Some of what you'll find is individual wires but there are also many that are connected together and you can rip off the width you need. Here's one from Adafruit but there is no shortage of them on ebay/amazon.


7

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 functionality to read and write multiple register ports at a time. Where the datasheet mentions a register, for example PIO_OWER, the Arduino library has ...


7

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 is being driven to by the digitalWrite function. The same is not true of the Due, which is an ARM based system. The IO pins function completely differently ...


7

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). Running those at 3.3V will mean you don't need logic level translation. Others, like the ADS1241, have "split power" where you can have different logic voltage (...


6

Either port can be used for programming, but the native USB port lets you do other things: It also enables the Due to emulate a USB mouse or keyboard to an attached computer. To use these features, see the Mouse and Keyboard library reference pages. The Native USB port can also act as a USB host for connected peripherals such as mice, keyboards, ...


5

Both the DigiX and the SIM908 are natively 3.3V boards. They should be able to connect to each other directly. For some reason, the SIM908 breakout seems to only offer RS232 level serial outputs for the GPRS and GPS. On U3 (the SIM908 module itself) Pins 68/71 offer 3.3V levels for the GPRS (GPRS-TXD and GPRS-RXD) and 15/16 offer 3.3V levels for the GPS (...


5

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 some frequency.) But to generate a clean sine wave (without a lot of distortion), you need to update a lot more frequenclly than two points per cycle. ...


5

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 that resistor and LED together. For your edit: Now your circuit looks like this: Behind the 5 pins in that column with the ground wire there is a big chunk ...


5

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 volts, so you can't connect it to the 3.3V pin on the Due. (You need to supply it with 5V). However the Due is a 3.3V device on its data pins, and thus you can't ...


4

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 base, be it a crystal, a ceramic resonator or a lab-grade frequency standard, there are two notions that should be distinguished: accuracy: how close is the ...


4

I am playing on a Arduino UNO, you would have to compare the datasheets to determine differences. For my research on this answer I am looking at: Code/PwmFrequency (for a quick rundown) Tutorial/PWM TimerPWMCheatsheet (explains the prescaller and resulting frequencies) varying the pwm frequency of timer0 and timer2 feature request: adjustable pwm ...


4

Again similar to Sachleen's answer. You can crimp your own connectors onto a ribbon cable, that way you can have the desired header size. I've just done this manually with some pliers (I couldn't afford the crimping tool) a bit tricky but I'm pleased with the results. I got all of the bits I needed from www.hobbytronics.co.uk. Anywho I'm happy with the ...


4

The ATmega16U2 on those boards isn't intended to be programmable by the end-user. It's only there to help convert from USB to TTL serial, which lets your computer communicate with the board's main microcontroller. It replaces the FTDI chip which was used on some older boards. In the case of the Uno, the main microcontroller is the ATmega328. For the Due, it'...


4

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 Arduino, you may need to make one. You cannot connect the 9V battery to any other part of the Due that I am aware of (without damaging it!). It is perfectly ...


4

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 sketch. 750 LEDs sounds like pushing it for the low-RAM Arduinos. You might want to look at NeoPixels Revealed: How to (not need to) generate precisely timed ...


4

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 actually required are the RTC and the watchdog. The slow clock can be generated from an internal RC oscillator instead of requiring an external crystal, but ...


4

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. While sample_buffer_full is set, it disables the body of the interrupt handler – ie, the handler's structure is if (!sample_buffer_full) { ...body of handler.....


4

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 simultaneously. Each serial software class (Serial1, Serial2, Serial3) has an internal buffer where data is stored until it is read. You only need to read the data ...


4

Try LED_BUILTIN: pins_arduino.h:static const uint8_t LED_BUILTIN = 13;


4

#define LED_BUILTIN 13 (source)


4

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 2012 and the formally provable SPARK language, for when you need your code to work. Any processor which gcc supports can potentially support Ada, whose Gnat ...


4

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 ${PortName} ${SerialSpeed} raw -clocal -echo icrnl Since I call these I can redirect from and to /dev/ttyxxx without problems. As far as I can see you mis the ...


4

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 the Due. Many older shield are not compatible with the Due, but do you really need to use an old shield ? Most sensors are 3.3V, and also a SD memory card is ...


4

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 report the number of elements, divide the total size by the number of bytes per element. For example: nElements = sizeof BuffA / sizeof BuffA[0]; As uint16_t ...


4

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 visible in the systems manager? Is it visible by the IDE? If you connect an adapter (12 or 9V), does it make a difference? If you try another Arduino, does it work ...


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