B4R Question Arduino H7 Portenta LED_BUILTIN equivalent port number

crupib

Member
I have an H7 Portenta arduino board. I am testing this software. I want to light up an led on the board to confirm it is working.
Please help.
 

gimballock

New Member
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?
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
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);
}
 
Upvote 0

crupib

Member
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?
How can I address those pins/ports using b4r code?
 
Upvote 0

crupib

Member
This is my code. It does not work.
Sub Process_Globals
Public Serial1 As Serial
Private LEDB As Pin
End Sub

Private Sub AppStart
Serial1.Initialize(9600)
Log("AppStart")
LEDB.Initialize(24,LEDB.MODE_OUTPUT)
LEDB.DigitalWrite(True)
End Sub
 
Upvote 0

gimballock

New Member
Try 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
 
Upvote 0

crupib

Member
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);
}
 
Upvote 0

crupib

Member
Try 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
Thanks ?
 
Upvote 0
Top