Merge branch 'master' of gitea.ctdo.de:interfisch/bobbycar
This commit is contained in:
commit
bb1841b4a6
|
@ -6,3 +6,29 @@ It is used alongside the controller_teensy firmware.
|
||||||
Log information is constantly printed out on one serial interface and can be written either to an sd card or transmitted via rf or bluetooth.
|
Log information is constantly printed out on one serial interface and can be written either to an sd card or transmitted via rf or bluetooth.
|
||||||
|
|
||||||
![screenshot](Screenshot.png "Screenshot")
|
![screenshot](Screenshot.png "Screenshot")
|
||||||
|
|
||||||
|
|
||||||
|
## OpenLog
|
||||||
|
|
||||||
|
Tutorial for OpenLog Serial SD Card logger: https://learn.sparkfun.com/tutorials/openlog-hookup-guide/configuration-file
|
||||||
|
|
||||||
|
Only works reliable on 3v3.
|
||||||
|
Using 5v restarts occur (prints 12> over serial and everytime a new file is created).
|
||||||
|
|
||||||
|
|
||||||
|
my CONFIG.TXT content:
|
||||||
|
115200,26,3,0,1,1,0
|
||||||
|
baud,escape,esc#,mode,verb,echo,ignoreRX
|
||||||
|
|
||||||
|
|
||||||
|
## HC12 433MHz Module
|
||||||
|
5v or 3v3.
|
||||||
|
Bridge Set pin to ground and power up to enter setup mode.
|
||||||
|
Use Arduino IDE to send commands via serial terminal with 9600 Baud.
|
||||||
|
AT+RX shows current settings.
|
||||||
|
|
||||||
|
Use following commands to setup:
|
||||||
|
AT+B115200
|
||||||
|
AT+C002
|
||||||
|
|
||||||
|
Using channel 2 instead of 1, because 1 receive didnt work with two computers.
|
||||||
|
|
|
@ -69,14 +69,14 @@ void draw() {
|
||||||
if (loopmillis>last_send+20) {
|
if (loopmillis>last_send+20) {
|
||||||
last_send=loopmillis;
|
last_send=loopmillis;
|
||||||
|
|
||||||
String wstring=time+","+cmd_FrontL+","+cmd_FrontR+","+cmd_RearL+","+cmd_RearR+","+current_FrontL+","+current_FrontR+","+current_RearL+","+current_RearR+","+speed_FrontL+","+speed_FrontR+","+speed_RearL+","+speed_RearR+","+temp_Front+","+temp_Rear+","+vbat_Front+","+vbat_Rear+","+currentAll+","+throttle+","+brake+"\n";
|
String wstring=time+","+cmd_FrontL+","+cmd_FrontR+","+cmd_RearL+","+cmd_RearR+","+nfc(current_FrontL,3)+","+nfc(current_FrontR,3)+","+nfc(current_RearL,3)+","+nfc(current_RearR,3)+","+speed_FrontL+","+speed_FrontR+","+speed_RearL+","+speed_RearR+","+nfc(temp_Front,2)+","+nfc(temp_Rear,2)+","+nfc(vbat_Front,2)+","+nfc(vbat_Rear,2)+","+nfc(currentAll,3)+","+throttle+","+brake+"\n";
|
||||||
serial.write(wstring);
|
serial.write(wstring);
|
||||||
print(wstring);
|
print(wstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loopmillis>last_update+20) {
|
if (loopmillis>last_update+20) {
|
||||||
last_update=loopmillis;
|
last_update=loopmillis;
|
||||||
n1+=0.1;
|
n1+=0.02;
|
||||||
time=loopmillis/1000.0;
|
time=loopmillis/1000.0;
|
||||||
updateValues();
|
updateValues();
|
||||||
}
|
}
|
||||||
|
@ -86,14 +86,14 @@ void draw() {
|
||||||
|
|
||||||
void updateValues() {
|
void updateValues() {
|
||||||
|
|
||||||
cmd_FrontL=int(noise(n1,0)*1000);
|
cmd_FrontL=int(noise(n1,2)*1000);
|
||||||
cmd_FrontR=int(noise(n1,0.001)*1000);
|
cmd_FrontR=int(noise(n1,2.001)*1000);
|
||||||
cmd_RearL=int(noise(n1,0.02)*1000);
|
cmd_RearL=int(noise(n1,2.02)*1000);
|
||||||
cmd_RearR=int(noise(n1,0.021)*1000);
|
cmd_RearR=int(noise(n1,2.021)*1000);
|
||||||
current_FrontL=noise(n1,2)*10-3;
|
current_FrontL=noise(n1-5,2)*10-3;
|
||||||
current_FrontR=noise(n1,2.001)*10-3;
|
current_FrontR=noise(n1-5,2.2)*10-3;
|
||||||
current_RearL=noise(n1,2.02)*10-3;
|
current_RearL=noise(n1-5,2.4)*10-3;
|
||||||
current_RearR=noise(n1,2.021)*10-3;
|
current_RearR=noise(n1-5,2.6)*10-3;
|
||||||
speed_FrontL=int(noise(n1,5)*600);
|
speed_FrontL=int(noise(n1,5)*600);
|
||||||
speed_FrontR=int(noise(n1,5.001)*600);
|
speed_FrontR=int(noise(n1,5.001)*600);
|
||||||
speed_RearL=int(noise(n1,5.02)*600);
|
speed_RearL=int(noise(n1,5.02)*600);
|
||||||
|
@ -102,7 +102,7 @@ void updateValues() {
|
||||||
temp_Rear=noise(n1/100.0,10.1)*3+30;
|
temp_Rear=noise(n1/100.0,10.1)*3+30;
|
||||||
vbat_Front=-noise(n1/100.0,11)*4+12*4.2;
|
vbat_Front=-noise(n1/100.0,11)*4+12*4.2;
|
||||||
vbat_Rear=-noise(n1/100.0,11.2)*4+12*4.2;
|
vbat_Rear=-noise(n1/100.0,11.2)*4+12*4.2;
|
||||||
currentAll=min(current_FrontL,current_FrontR,min(speed_RearL,speed_RearR));
|
currentAll=min(current_FrontL,min(current_FrontR,min(current_RearL,current_RearR)));
|
||||||
throttle=int(noise(n1,15)*1000);
|
throttle=int(noise(n1,15)*1000);
|
||||||
brake=max(0,int(noise(n1,18)*1000-800));
|
brake=max(0,int(noise(n1,18)*1000-800));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue