Hello,
I have been able to write to the serial port window (Grand Central M4 (SAMD51 on 'COM6') in the Arduino IDE 2.0.0. I am not however able to read from this window. When I perform a Serial.available command and provide a return variable, then print this variable, it returns a 0. I know this variable changes as I initialize it as 50 when I start. It should return a 1. In Setup I use a Serial.begin(9600) and while(!Serial) command(s). I studied an Adafruit tutorial on this subject and can't seem to find a solution. Any help would be appreciated. All feedback was via the serial window within the Arduino environment. Using MS Windows 10.
Serial Read Issue
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_carter
- Posts: 29163
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Serial Read Issue
available() only returns the number of bytes available for reading. You'd then call read() to actually read the value.
See basic example here:
https://www.arduino.cc/reference/en/lan ... available/
See basic example here:
https://www.arduino.cc/reference/en/lan ... available/
- JPF100
- Posts: 17
- Joined: Mon Sep 12, 2022 11:10 am
Re: Serial Read Issue
Thank you very much. That worked!
- JPF100
- Posts: 17
- Joined: Mon Sep 12, 2022 11:10 am
Re: Serial Read Issue
From you help, I was able to create a language independent VERY simple serial CLI to manipulate all of the DIO on the Grand Central. Onward to SPI!
- JPF100
- Posts: 17
- Joined: Mon Sep 12, 2022 11:10 am
Re: Serial Read Issue
I am now working on simple SPI interface. I have 2 GCs connected in a master/slave or controller/peripheral configuration. I am using the Arduino environment. I have been able to transmit from the controller to the peripheral, but I want to be able to read the transmitted byte from the controller on the peripheral side and display it on the peripheral's serial port console. I setup the peripheral using a series of SERCOM1 commands. This setup enables interrupts on the peripheral side of things. I successfully read back the data on the controller side. I confirmed that all of the lines are setup correctly with an oscilloscope. I also confirmed with a scope that the data being transmitted back to the controller is correct on the CIPO line with the clock. Any help would be appreciated.
Please be positive and constructive with your questions and comments.