-
Notifications
You must be signed in to change notification settings - Fork 0
User Guide: PicoC
This site is a really first beginning.
During startup I will collect german information that I translate a little bit later. But for me it's easier to do it this way ;)
Sorry.
- ModuleSettings
- AdminState
- PicoC = Enable
PicoC in Interactive-Mode
- ModuleSettings
- PicoCSettings
- Startup = OnBoot
- Source = Demo
USB_VCPPort = PicoC In this case you have a virtual serial parallel to you normal USB for GCS If Source = Demo you see a counter written to you terminal. If this is ok, change Source to File and save the settings.
Howto put a script to you board
goto
- Data Objects
- PicoCStatus
- Command = USARTmode
Goto to your terminal and enter Ctrl-A you should get start of heading as answer. If yes, your terminal work well. On windows Putty didn't work for me. I use Tera Term. You have the following commands in USARTmode:
- CTRL-A: Clear buffer, pointer to zero
- CTRL-B: Open buffer, all input goes to the buffer now
- CTRL-C: Block buffer, save pointer. Ctrl-B enable writing again
- CTRL-D: Block buffer, pointer to zero
- CTRL-E: read out the whole buffer
To write a file to the buffer, use this stepps:
- Ctrl-A
- Ctrl-B
- Copy your source to clipboard
- Send Clipboard to board (Ctrl-V in terminal)
- Ctrl-C
- Ctrl-D
now you can check the buffer with Ctrl-E. You should now see your source!
- Data Objects
- PicoCStatus
- Command = SaveFile or Idle
Should save the file to the flash or simply end the USARTmode.
Following some example scripts.
Sonar HC-SR04
- PPM+PWM+ADC
- OUT5 = Trigger,
- IN2 = Echo
#include "system.h"
#include "pwm.h"
PWMFreqSet(2,10); /* set channel 5-6 to 10Hz */
PWMMinSet(5,0); /* set channel 5 Min to 0 */
PWMValSet(5,10); /* set channel 5 to 10µs pulse */
while (getchar() != 27) {
float distance = PWMValGet(1)/58.0;
printf("Distance = %f cm\n", distance);
delay(500);
}
Sinus-LED via Accessorychannel
- Out5---470R---LED---GND
- GCS Output: Channel 5 set 0 to 20.000 and neutral to 10.000
- MixerSettings / Mixer5Type / Accessory0
#include "system.h"
#include "math.h"
int main() {
sync(0);
float f = 0;
while (!armed()) {
AccessoryValSet(0,sin(f));
f=f+0.1;
printf("%f\n", sin(f));
sync(20);
}
AccessoryValSet(0,-1);
return 0;
}
exit(main());