How could I make an HTTP request to a website with VexV5 code? I’d like to display some statistics on the Vex bot’s screen. Would I have to install libcurl to do something like this, and if so, how would I do that?
I don’ think there is any way to get a V5 brain connected to the internet.
depends how hard you’re willing to try (and if it needs to be competition legal)
One could always connect the brain to a raspi or something and use that to connect to the interwebs.
Yeah true, you could have a program running on a laptop/RPi/arduino that is connected to the internet and relays data to the brain via a USB cable (connected either directly to the brain or to the controller), or via RS485 to a smart port.
Provided that the computer running the program was legally powered (and connected to directly to the brain rather than to the controller), I think such a setup might actually be legal in VEXU under VUR10.
Alternatively perhaps you could make use of the upcoming companion phone app for the V5 Brain. Here’s what VEX had to say when they announced it:
The ability to tweet at the end there is what leads me to think that you might be able to access the internet in general through that app. It would be cool to hear something from VEX about when this app might be released, and on if general internet access might be available.
As for legality, unfortunately this kind of functionality would definitely violate either electronics restrictions or communication restrictions, no matter whether you are competing in VRC or VEXU (or VAIC).
You’re right, I forgot about R17.
i don’t know if this is what you are meaning, or if this even helps with what you are doing, but you might like this code i made, you can make it print anything on the brain like sensor values or just text, and it doesn’t interfere with the rest of the code.
#include "vex.h"
using namespace vex;
competition Competition;
//variables
void pre_auton(void) {
vexcodeInit();
}
void statistics(void) {
Brain.Screen.clearScreen();
while(1){
Brain.Screen.print("pot value:", A.angle(degrees), "inetial pitch:" ,I.orientation(pitch, degrees) );
Brain.Screen.newLine();
Brain.Screen.print("pot roll:", I.orientation(roll, degrees), "inetial yaw:" ,I.orientation(yaw, degrees) );
wait(.3,seconds);
Brain.Screen.clearScreen();
}}
void autonomous(void) {
}
void usercontrol(void) {
while (1) {
if (Controller1.ButtonL1.pressing()) {
thread(statistics).detach();
}
}
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);
// Run the pre-autonomous function.
pre_auton();
// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}