Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arduino-mega]

A microcontroller board based on the ATmega2560 or 1280 chip. Use this tag for questions specifically regarding the Mega, and not just general Arduino usage.

37
votes
1answer
154k views

How do you use SPI on an Arduino?

With reference to the Arduino Uno, Mega2560, Leonardo and similar boards: How does SPI work? How fast is SPI? How do I connect between a master and a slave? How do I make an SPI slave? Please note: ...
49
votes
11answers
265k views

How do I split an incoming string?

I am sending a list of servo positions via the serial connection to the arduino in the following format 1:90&2:80&3:180 Which would be parsed as: servoId : Position & servoId : Position ...
25
votes
7answers
25k views

How can I get a unique ID for all my Arduino boards?

Once you have uploaded a sketch to one of your Arduino boards, it is hard to know exactly what source code led to that sketch. Indeed, you may change the source code of your sketch on your PC without ...
6
votes
4answers
6k views

How to interconnect multiple Arduinos with a Rpi to control home-lights/switches

While planning the lightning infrastructure (wall-switches and lights) of my new home (it's still under-construction) I choosed to go through the "automated route" way and due to my background (I'm an ...
1
vote
1answer
178 views

ArduinoISP external programmer produces verification error?

I am using an ArduinoISP external programmer to upload a sketch to an Arduino MEGA. I set the processor type to MEGA 2560, and use Ctrl-Shft-U to upload using a programmer. My programmer is set to ...
10
votes
2answers
22k views

Arduino Mega timeout communication with programmer error

I have an Arduino Mega 2560 and it was working fine until about lunch time when I started getting this error: avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout ...
0
votes
1answer
237 views

Can I control a cellphone's lcd (+touch screen)?

I had an Xperia txt pro just laying around and tried to revive it. I burned it like an idiot using 5v in the battery pins by accident :/ So I decided to read it apart and got to the lcd, can I use my ...
0
votes
1answer
5k views

Store TinyGPS++ latitude value into a variable of type string or float

I want to get the GPS ordinates in degrees with 6 decimal accuracy. I can obtain this by creating a gps object with TinyGPS library. but In the TinyGPS example codes, its written Serial.println(gps....
0
votes
1answer
148 views

How to interpret analog values sent to Arduino from line scanner?

So I have a line scan camera attached to my Arduino Mega and I'm trying to send it a digital clock impulse and get an analog output back. The line scan camera is supposed to return 128 pixels. So far ...
9
votes
4answers
28k views

2.4" TFT LCD Shield isn't working on Arduino Mega

Even on ebay's website it is mentioned that I can't use 2.4" TFT LCD Shield display on attach to Arduino Mega. The problem is that I bought this shield by mistake. I want to put this shield onto ...
2
votes
2answers
4k views

Detect movement on moving robot? PIR Sensor

I am working on a human following robot project and I am trying to achieve this with 1 Ultrasonic sensor that makes sure the robot won't crash into something and 3 PIR sensors that will detect human ...
7
votes
2answers
3k views

How to update a variable in an ISR using Timers

I'm trying to check the frequency of Timer3 using a counter. The value of the counter, declared as volatile, is incremented in the ISR and every second the sum is shown in the main loop and the value ...
3
votes
2answers
5k views

Equivalent for PORTB in Arduino Mega 2560

Like I said in the subject, I would like to know the equivalent for the instruction: PORTB |= 0x01; PORTB &= ~0x01; More precisely I was using it to trigger a fast pulse conversion on my shield-...
3
votes
3answers
14k views

How to clear FIFO buffer on MPU6050?

my MPU6050 works very unstable , the problem is unable clear excessed FIFO buffer on MPU6050, I am using Jeff Rowberg's MPU library and according to his DMP example but without using interruptions,...
3
votes
2answers
7k views

Arduino Countdown without using delay()

I am working on a project which requires countdown from 30sec to 0sec. I can't use delay() function because I am taking input from keyboard during countdown. millis() function wont help because my ...
2
votes
2answers
7k views

Use RFID-RC522 with other Pins

I'm wondering where the pin setting is manifested in the library. I want to use the RC522 with other digital pins than the default 50-53 pins, because I am using a shield for a display on theese ports....
2
votes
2answers
367 views

Syntax for declaring more than one serial pins of Arduino mega?

How can I declare multiple serial ports for Arduino Mega as it has been in the example below? #include <SoftwareSerial.h> SoftwareSerial mySerial(18,19); // RX, TX //how this syntax can be ...
1
vote
1answer
2k views

Is ATMEGA328P the same as 16U2?

I've been playing with my Arduino for a few months. But, I just bought a shield that says it needs to be used with ATMEGA328P. My box says I have a 328P, however, reading the chip, it's inscribed ...
1
vote
0answers
42 views

Getting data from web form [duplicate]

I am using an EthernetServer and EthernetClient with Arduino in order to make a simple webpage. I have a web form for a user to enter various codes that can reset data stored on the back end. However, ...
1
vote
5answers
3k views

Arduino Mega and other modules power consumption

I have an Arduino Mega 2560 to which I have connected: Arduino GSM Shield 2 Waveshare 10 DOF IMU sensor Waveshare NEO-7M-C (B) GPS module HC-05 ZS040 Bluetooth module I am feeding my Arduino a 12V ...
1
vote
1answer
4k views

How can you reduce the clock frequency of an Arduino Mega?

I'm trying to debug a problem and need to reduce the speed of the clock on my Arduino Mega from 16MHz to 8MHz. I can't find any simple way of doing so, so I wanted to know if there were any gurus ...
1
vote
2answers
3k views

Arduino I2C communication between Raspberry Pi

We are trying to communicate between multiple Arduino's (in this example a Nano and a Mega) and a Raspberry Pi. The Raspberry pi is defined as master and the Arduino's as slaves. We would also like ...
1
vote
2answers
380 views

Why PJ0 and PJ1 are not reporting as PCINT pins

When the sketch shown at end-of-question is compiled and uploaded to an Arduino board, it is supposed to Serial-print a list of available digital pins, showing for each pin whether it supports PWM or ...
0
votes
1answer
344 views

Arduino Mega 2560 with SIM808 module - Incomplete SMS response

I have this code to read a SMS: String read_SMS(int index) { Serial.println("--START READ SMS POSITION" + String(index) + "--"); delay(400); sendATcommand("AT+CMGF=1", "OK", 1000); // sets ...
0
votes
1answer
96 views

NodeMCU not responding AT after blink app

I've just bought NodeMCU LoLin ESP8266, I tried to send AT commands (after spending days on ESP8266-01) and everything was okay. Than I've uploaded the Blink example to the board, after that moment it'...
0
votes
1answer
401 views

How to read a higher voltage digital input?

Lets suppose I have a circuit with a car battery, a switch and a led. The led will turn on when the switch is closed, and turn off if it's not. I want to remove the led from the circuit and put an ...
0
votes
1answer
165 views

Arduino I2C Register Read

I am trying to read a specific register from a device. In this case I am trying to read the value stored in register 0X1F from slave device 0x08. On the scope I see writes for ADDRESS_SLAVE(Wire....
22
votes
8answers
11k views

Are global variables evil in Arduino?

I'm relatively new at programming and many of the coding best practices I'm reading effectively state that there are very few good reasons to use a global variable (or that the best code has no ...
3
votes
3answers
9k views

How to read bitmap image on Arduino

I want to convert a bitmap into binary array. My bitmap image is 272*208 pixel monochromatic 1bpp image. I'm confused when the width I get from my image is 16 instead of 272, the height is corrected. ...
6
votes
3answers
26k views

I2C 2 way communication between Arduino Uno and Arduino Mega

If I remove the transmission code from slave this works properly but I need to transmit from slave. Here is my master code #include <Wire.h> void setup() { Wire.begin(3); Wire.onReceive(...
3
votes
4answers
21k views

3.5" TFT LCD Display is not working with Arduino Mega 2560 R3

Even I can't do similarly with my 2.4" TFT LCD in here still: 2.4" TFT LCD Shield isn't working on Arduino Mega Now, I have bought 3.5" TFT LCD display for my Arduino Mega 2560 R3 to try ...
9
votes
1answer
3k views

Setting timer3 in CTC mode - conflict with servo library

I would like to set up a timer in order to call a function 800 times per second. I'm using the Arduino Mega and Timer3 with a prescaler of 1024. To choose the prescaler factor I've considered the ...
9
votes
4answers
8k views

What is the cheapest way to add wifi to Arduino?

I am trying to find some sort of wifi adapter for Arduino, it needs to be as small as possible (not a shield) and as cheap as possible. So far I can only seem to find shields that cost about £10+ ...
7
votes
2answers
3k views

OOP vs Inline with Arduino

I have been programming for quite a while now but I am new to Arduino and AVR Programming. The main question I have about programming these Micro-controllers is are there major differences in ...
3
votes
1answer
671 views

Setting the frequency of a timer interrupt

The concept: Play a sine wave saved as a character array in PROGMEM through an 8-bit DAC connected to the PORTC pins on the Arduino Mega. This works: // File just defines an array and a size #...
2
votes
2answers
7k views

Why is my interrupt code not working?

Background I'm trying to write code to read signals from a six-channel RC receiver on an Arduino Mega 2560. Currently I am keeping the code to just read one channel to make things easy to ...
2
votes
1answer
2k views

Using the Waspmote Sensor Board

Spanish company Libelium makes this pretty impressive sensor board: http://www.libelium.com/products/waspmote/sensors/ for their Waspmote series of boards. These are not meant for Arduino ...
2
votes
3answers
2k views

What does “Arduino compatible” mean?

I wanted to buy an Arduino (ATmega) 2560 (8 Bit MCU) via Amazon. But there was no Arduino visible. There was only a SainSmart 2560 and SunFounder 2560 On both websides (SainSmart and SunFounder) ...
2
votes
2answers
495 views

Unable to create a desired periodic signal with Arduino Mega 2560 and DAC0808

I wrote the code to produce the periodic signal by using arduino and DAC0808 where i turned on and off the respectively pins of PORTA by using a logic in iterative manner and created the periodic ...
2
votes
4answers
13k views

How to wire up 4-digit 7-segment display?

I have an Arduino Mega and the CL5642BH, a 4-digit 7-segment display. I found very helpful code here, but I don't understand how to wire it up on the breadboard. The display has 12 pins: 6 on the top ...
1
vote
2answers
3k views

ESP8266 error: espcomm_upload_mem failed while uploading sketch

First of all, I would like to apologize for posting this error once again to this community. However, I have been studying articles for last many days to resolve this error. Unfortunately, I did not ...
0
votes
1answer
5k views

Atmel studio 7 - my own libraries

I like to use AS7 to make my programs. I know c and some c++, but how things work from there I'm green. I would like to know if there is a folder where I can store my own homemade c and h library ...
0
votes
2answers
2k views

How to set address for using more than MPU9250 [duplicate]

I am trying to build a project that contains more than one MPU 9250, until now I'm still confused to MPU9250. If I were going to that, does anybody here know how to set addresses to each of the MPU's ...
0
votes
1answer
752 views

How would i capture and split serial data?

How would i capture the following serial data, and split it into parts? <Alarm,MPos:0.000,0.000,0.000,WPos:0.000,0.000,0.000> the parts i need from this is Alarm - This is a state. i.e Alarm, ...
2
votes
4answers
4k views

How to use Multiple MPU9250 to Arduino Lilypad [duplicate]

Is it possible to connect more than one or to be specific 5 MPU9250 into 1 Arduino lilypad? How will I set the addresses, and where should I put the pins for SDA and SCL? I hope someone out there ...
2
votes
2answers
857 views

Arduino Variable Data Type?

Is there a variable data type available for Arduino? I have a class that should have a member that will differ in data type, in the past I have used the "variable" keyword in c++ but when I tried to ...
2
votes
1answer
681 views

“tamper” circuit of a reed switch: can I connect the two wires to an INPUT and an OUTPUT pin?

While working for the automation side of my new house, I'm currently in the process of installing several reed switches on top of external doors and windows. Even if this could be used as a "...
1
vote
1answer
5k views

USB D+ D- to Arduino Mega RX TX

Is it possible to directly communicate USB D+ D- to Arduino Mega serial port TX RX?
1
vote
5answers
2k views

Mega 2560 Doesn't Respond

When trying to upload to my Mega r2, it simply times out during uploading. avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer I tried ...
1
vote
3answers
4k views

Arduino Ethernet Shield 2 stuck on EthernetServer::begin()

I am currently trying to get the Ethernet Shield working on my Mega. I was trying to run the Webserver example but the program seems to stuck at one point, so I tried to start from scratch. This is ...