Closed diplodocuslongus closed 2 years ago
@diplodocuslongus Arduino deprecated RPC, and I haven't caught up with fixing things. Libraries are a bit of a pain in Platformio. as my students go through my course we should figure out all the lib dependencies.
Have you installed the Portenta Pro Community Solutions. It has most of my up to date code. Search the IDE for "community" it also installs onto Platformio .
try:
/*
* e-print-from-m4-core-rpc.ino for the Portenta H7
*
* GNU GENERAL PUBLIC LICENSE
* Use at your own risk.
************************************************ Important stuff if needed ****************************************
*
*
*
********************************************************** end ****************************************************
*
*
* The PortentaH7 M4 core can not print to the serial monitor
* On the M4 core if you do a Serial.Println it goes to the TX RX UART output pins
* This program uses RPC to redirect Serial.println to the M7 core
* so that regular sketches still work with serial monitor output from the M4 core
*
*
* updated August 2nd, 2020
* by Jeremy Ellis
* Twitter @rocksetta
* Website https://www.rocksetta.com
*
* I have re-written this to make larger programs easier
* by seperating the M7 and M4 code completely.
*
*/
#ifdef CORE_CM7 // Start M7 programming
#include "RPC.h" // comes with the mbed board installation
void setup() {
bootM4();
Serial.begin(115200);
RPC.begin();
}
void loop() {
while (RPC.available()) {
Serial.write(RPC.read());
}
// delay(1);
}
#endif // End all M7 core programming
/////////////////////////////////////////////////////////////////////////////////////////////
#ifdef CORE_CM4 // Start M4 programming
#include "RPC.h" // comes with the mbed board installation
#define Serial RPC // So the M4 regular serial prints to RPC
void setup(){
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin();
// while (!Serial); // Please don't do this it messes up beginners
}
void loop() {
Serial.println( ); delayMicroseconds(1234);
Serial.println("A0 Analog Read max = 1023, Actual Value: "+String(analogRead(A0)) ); delayMicroseconds(1234);
Serial.println("A1 Analog Read max = 1023, Actual Value: "+String(analogRead(A1)) ); delayMicroseconds(1234);
Serial.println("A2 Analog Read max = 1023, Actual Value: "+String(analogRead(A2)) ); delayMicroseconds(1234);
Serial.println("A3 Analog Read max = 1023, Actual Value: "+String(analogRead(A3)) ); delayMicroseconds(1234);
Serial.println("A4 Analog Read max = 1023, Actual Value: "+String(analogRead(A4)) ); delayMicroseconds(1234);
Serial.println("A5 Analog Read max = 1023, Actual Value: "+String(analogRead(A5)) ); delayMicroseconds(1234);
Serial.println("A6 Analog Read max = 1023, Actual Value: "+String(analogRead(A6)) ); delayMicroseconds(1234);
Serial.println("-----------------------------------------------------------------"); delayMicroseconds(1234);
Serial.println(); delayMicroseconds(1234);
// Flash LED 3 times
digitalWrite(LED_BUILTIN, LOW);
delay(10);
digitalWrite(LED_BUILTIN, HIGH);
delay(10);
digitalWrite(LED_BUILTIN, LOW);
delay(10);
digitalWrite(LED_BUILTIN, HIGH);
delay(10);
digitalWrite(LED_BUILTIN, LOW);
delay(10);
digitalWrite(LED_BUILTIN, HIGH);
delay(100); // longer wait
}
#endif // End all M4 core programming
/*
* Clickable links for helpful information
* By @rocksetta
* March, 2021
* GNU GENERAL PUBLIC LICENSE
* Use at your own risk.
*
*
*
* Artduino Pro Links:
*
* https://store.arduino.cc/usa/portenta-h7
* https://forum.arduino.cc/index.php?board=148.0
* https://www.arduino.cc/pro/tutorials/portenta-h7
*
* Rocksetta links:
*
* https://twitter.com/rocksetta
* https://github.com/hpssjellis/portenta-pro-community-solutions
* https://github.com/hpssjellis/my-examples-for-the-arduino-portentaH7
* https://github.com/hpssjellis/arduino-high-school-robotics-course
* https://www.youtube.com/playlist?list=PL57Dnr1H_egtm0pi-okmG0iE_X5dROaLw
*
*
*
*/
Thanks.
I installed your library in both platformIO and the arduino IDE (1.8.19), it compiles fine in the IDE but in PIO it complains it can't find the asio.hpp
header when referring to rpclib:
$ pio run
[...]
Dependency Graph
|-- <RPC> 1.0
| |-- <rpclib> 1.0.0
| |-- <openamp> 1.0
Building in release mode
Compiling .pio/build/portenta_h7_m7/src/main.cpp.o
Generating LD script .pio/build/portenta_h7_m7/cpp.linker_script.ld
Compiling .pio/build/portenta_h7_m7/lib9bb/rpclib/format.cpp.o
Compiling .pio/build/portenta_h7_m7/lib9bb/rpclib/rpc/client.cc.o
Compiling .pio/build/portenta_h7_m7/lib9bb/rpclib/rpc/detail/client_error.cpp.o
/home/ludozb/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src/rpc/client.cc:13:10: fatal error: asio.hpp: No such file or directory
asio.hpp isn't present anywhere here https://github.com/arduino/ArduinoCore-mbed, which is what is install in ~/.platformio, but does exists in the original rpclib repository : https://github.com/rpclib/rpclib, asio.hpp being here: https://github.com/rpclib/rpclib/tree/master/dependencies/include
But all that is way beyond my original issue... I'll see where is best to ask a question about my problem, most likely on the platformIO forum.
Ludo
I let my students figure out the library dependencies. Platformio has a strange non-GUI way to do it.
For my pixy you have to add
lib_deps = arduino12/pixy2@^1.0.4
For the Grove OLED it is
lib_deps = olikraus/U8g2@^2.32.10
These go in your platfomio.ini file
Hello Jeremy, This is an incredible amount of resource you have put together here. I'm getting started with both the portenta and platformio, I can run the blink example and the dual core blink, but not the RPC blink example
my02b-dual-core-RPC.ino
, PlatformIO complains it can't find RPC_internal.h:and I can't find anything about RPC_internal.h in the PlatformIO registry, nor could I find anything obvious searching for mbed in the registry search form at : I've read on another forum (arduino one? ) that you also use PlatformIO, so I thought I'd ask you here (though this is definitely a PlatformIO question...):
how do I install RPC_internal.h in PlatformIO or setup PlatformIO so it find this header?
Thanks, Ludo