Once you know the number, you simply pass it to Pin.Initialize.Yet another question may be how to address those pins/ports in B4R?
*
Blink green LED using Portenta M7 Core
*/
const int ON = LOW; // Voltage level is inverted
const int OFF = HIGH;
void setup() {
bootM4(); // Boot M4 core
pinMode(LEDG, OUTPUT); // Set green LED as output
}
void loop() {
digitalWrite(LEDG, ON); // Turn green LED on
delay(1000); // Wait for 1 second
digitalWrite(LEDG, OFF); // Turn green LED off
delay(1000);
}
How can I address those pins/ports using b4r code?The Portenta board has (3) onboard LED's, (Red, Green, Blue). Which one/s are you trying to test with?
The question may be what pins, port, etc., are the onboard LED's wired to?
Yet another question may be how to address those pins/ports in B4R?
I can do this , I am trying to use basic B4R (basic) to do this.Maybe this can help...
This worked thanks.The answer is here: C:\Users\H\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\2.0.0\variants\PORTENTA_H7_M4\pins_arduino.h
#define LEDR (23u)
#define LEDG (24u)
#define LEDB (25u)
LEDG = 24
Please use [code]code here...[/code] tags when posting code.
Your code looks correct (assuming that the baud rate is configured in the IDE correctly).
My code does not work , even after the baud rate. When you say configure the baud rate are you referring to board selector?
LEDG is simbolic for green
This example program:
B4X:* Blink green LED using Portenta M7 Core */ const int ON = LOW; // Voltage level is inverted const int OFF = HIGH; void setup() { bootM4(); // Boot M4 core pinMode(LEDG, OUTPUT); // Set green LED as output } void loop() { digitalWrite(LEDG, ON); // Turn green LED on delay(1000); // Wait for 1 second digitalWrite(LEDG, OFF); // Turn green LED off delay(1000); }
ThanksTry this:
Code here....
Sub Process_Globals
Public Serial1 As Serial
Private LED_Red As Pin 'pin for the red Led
Private LED_Green As Pin 'pin for the green Led
Private LED_Blue As Pin 'pin for the blue Led
End Sub
' Set to use M7 core, 115200 Baud
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
LED_Red.Initialize(23, LED_Red.MODE_OUTPUT)
LED_Green.Initialize(24, LED_Green.MODE_OUTPUT)
LED_Blue.Initialize(25, LED_Blue.MODE_OUTPUT)
Do While True
LED_Red.DigitalWrite(True)
Delay(500)
LED_Green.DigitalWrite(True)
Delay(500)
LED_Blue.DigitalWrite(True)
Delay(500)
LED_Red.DigitalWrite(False)
Delay(500)
LED_Green.DigitalWrite(False)
Delay(500)
LED_Blue.DigitalWrite(False)
Delay(500)
Loop
End Sub