Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Serial1 on Mega 2560 board(Can now serial ports)
icon7.gif  Serial1 on Mega 2560 board [message #1754936] Fri, 24 February 2017 09:34
Francis Pantus is currently offline Francis PantusFriend
Messages: 3
Registered: February 2017
Junior Member
Dear Forum members,

My setup:

    Eclipse, 64 bit, V Neon.2
    Java runtime environment, use 64 bits, V 8.12
    Python environment, use 64 bit, V 3.5.3
    Mega 2560 board
    Arduino AVR boards platform
    Arduino/BGenuino Mega or Mega 2560 connection
    Arduino Software serial library for the project to test SoftwareSerial
    Adafruit Ultimate GPS board connected to serial 1 port (TX pin 18, RX pin 19)


The test program
#include <Arduino.h>
#include <HardwareSerial.h>

void setup() {
  while (!Serial);
  Serial.begin(115200);
  Serial1.begin(9600);
  Serial1.print("HardwareSerial started");
}
void loop() {
  if (Serial1.available()) {
    char c = Serial1.read();
    Serial.write(c);
  }
}


After going around in circles for days Mad , the above program now works in the Eclipse Arduino IDE. I'm not sure why the same code didn't work for about 4 days, but it must have decided that I spent enough time and started working this morning Very Happy . Maybe because I started a new project from scratch, copy/pasted the same code into the source file and re-linked libraries. Or maybe the sacrificial chicken.

For others struggling with Mega 2560 board serial ports: if you're testing this code with a software serial port, you can't use the 'normal' serial ports Rx pins (i.e. 19, 17 or 15 on my board) as they do not accept interrupts (needed by SoftwareSerial). Only the following pins can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 (see SoftwareSerialExample). I used port 50.

Cheers

[Updated on: Sun, 26 February 2017 06:05]

Report message to a moderator

Previous Topic:Concept for finding Struct definitions in external header files
Next Topic:How to handle the random numbers within the .cproject file?
Goto Forum:
  


Current Time: Wed Sep 25 07:36:50 GMT 2024

Powered by FUDForum. Page generated in 0.07883 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top