Browse Source

diverses

master
Yves Ehrlich 4 years ago
parent
commit
968dc11fdd
  1. 1
      .~lock.ideen_mechanik_und_elektronik.odt#
  2. 2
      Code/miniRobotRC/JoystickSteuerung.ino
  3. 26
      Code/miniRobotRC/_main.ino
  4. 3
      Code/miniRobotRC/fahrsteuerung_old.ino
  5. 4
      Code/miniRobotRC/interruptRoutinen.ino
  6. 3
      Code/miniRobotRC/miniRobotRC.ino
  7. 10
      Code/miniRobotRC/temp.ino

1
.~lock.ideen_mechanik_und_elektronik.odt#

@ -1 +0,0 @@
,yves,yves-UB,05.02.2020 13:51,file:///home/yves/.config/libreoffice/4;

2
Code/miniRobotRC/JoystickSteuerung.ino

@ -60,7 +60,7 @@ void joystickInit() {
lcd.print("RightPWM: "); lcd.print("RightPWM: ");
lcd.print(right -> PWMValue);*/ lcd.print(right -> PWMValue);*/
lcdLines[0] = "Links: " + String(left -> PWMValue, DEC); lcdLines[0] = "Links: " + String(left -> PWMValue, DEC);
lcdLines[1] = "Links: " + String(right -> PWMValue, DEC);
lcdLines[1] = "Rechts: " + String(right -> PWMValue, DEC);
} }
void send(){ void send(){

26
Code/miniRobotRC/_main.ino

@ -15,7 +15,7 @@ void setup() {
driveTimeout = 10; driveTimeout = 10;
joystickInit(); //TODO joystickInit(); //TODO
clearCommands(); clearCommands();
renderTime = millis();
} }
void loop() { void loop() {
@ -23,17 +23,22 @@ void loop() {
while(!tasten.getButtonCycle(buttonStart)) { while(!tasten.getButtonCycle(buttonStart)) {
manualDigitalDrive(); manualDigitalDrive();
updateTemp();
//updateTemp();
String temp_str = "T: " + String(temperature) + " Grad C";
lcdLines[5] = temp_str;
refreshLCD();
} }
tasten.clearButton(buttonStart); tasten.clearButton(buttonStart);
while(!tasten.getButtonCycle(buttonStart)){ while(!tasten.getButtonCycle(buttonStart)){
motorMapping(); motorMapping();
updateTemp();
//updateTemp();
refreshLCD();
} }
tasten.clearButton(buttonStart); tasten.clearButton(buttonStart);
while(!tasten.getButtonCycle(buttonStart)){ while(!tasten.getButtonCycle(buttonStart)){
joystickSteuerung(); //TODO () joystickSteuerung(); //TODO ()
updateTemp();
//updateTemp();
refreshLCD();
} }
tasten.clearButton(buttonStart); tasten.clearButton(buttonStart);
} }
@ -43,3 +48,16 @@ void lcdMenu() {
} }
void refreshLCD() {
if((millis() - renderTime) >= renderTimeout) {
lcd.clear();
for(uint8_t i = 0; i < sizeof(lcdLines); i++) {
lcd.gotoXY(0, i);
lcd.print(lcdLines[i]);
}
lcd.renderAll();
renderTime = millis();
}
}

3
Code/miniRobotRC/fahrsteuerung_old.ino

@ -1,12 +1,11 @@
void manualDigitalDrive() { void manualDigitalDrive() {
bool goOn = false; bool goOn = false;
String temp_str = "T: " + String(temperature) + " Grad C";
lcdLines[5] = temp_str;
// while(!tasten.getButtonCycle(buttonL1)) { // while(!tasten.getButtonCycle(buttonL1)) {
clearCommands(); clearCommands();
if(!tasten.getAnyPressed()) { if(!tasten.getAnyPressed()) {
lcdLines[0] = "Warte..."; lcdLines[0] = "Warte...";
lcdLines[1] = "";
} }
if(tasten.checkButton(buttonB) || tasten.checkButton(buttonUp)) { if(tasten.checkButton(buttonB) || tasten.checkButton(buttonUp)) {

4
Code/miniRobotRC/interruptRoutinen.ino

@ -1,7 +1,7 @@
//HIER KOMMT ALLES REIN WAS 1 MAL PRO ms AUFGERUFEN WERDEN SOLL!!! //HIER KOMMT ALLES REIN WAS 1 MAL PRO ms AUFGERUFEN WERDEN SOLL!!!
ISR(TIMER2_COMPA_vect) { ISR(TIMER2_COMPA_vect) {
tasten.checkButtons(); tasten.checkButtons();
renderTime++;
/*renderTime++;
if(renderTime >= renderTimeout) { if(renderTime >= renderTimeout) {
lcd.clear(); lcd.clear();
for(uint8_t i = 0; i < sizeof(lcdLines); i++) { for(uint8_t i = 0; i < sizeof(lcdLines); i++) {
@ -10,6 +10,6 @@ ISR(TIMER2_COMPA_vect) {
} }
lcd.renderAll(); lcd.renderAll();
renderTime = 0; renderTime = 0;
}
} */
} }
//ALLE anderen ISR kommen HIER drunter!!! //ALLE anderen ISR kommen HIER drunter!!!

3
Code/miniRobotRC/miniRobotRC.ino

@ -16,7 +16,7 @@ volatile myInterrupts Timer2;
volatile myInterrupts pwmBL; volatile myInterrupts pwmBL;
volatile shiftRegButton tasten; volatile shiftRegButton tasten;
//LCD //LCD
uint8_t renderTime = 0;
/*uint8_t */long renderTime = 0;
#define renderTimeout 100 //es wird alle 100ms gerendert #define renderTimeout 100 //es wird alle 100ms gerendert
String lcdLines[6]; //Strings welche alle 100ms ausgegeben werden String lcdLines[6]; //Strings welche alle 100ms ausgegeben werden
@ -42,6 +42,7 @@ uint16_t driveTimeout = 0;
uint8_t distance; uint8_t distance;
uint8_t temperature = 0; uint8_t temperature = 0;
unsigned long temp_time = millis(); unsigned long temp_time = millis();
//Funk //Funk

10
Code/miniRobotRC/temp.ino

@ -7,7 +7,7 @@
clearCommands(); clearCommands();
commands[0] = getTemp; commands[0] = getTemp;
radio.write(&commands, sizeof(commands) && !err);
radio.write(&commands, sizeof(commands) /* && !err */);
unsigned long start = micros(); unsigned long start = micros();
radio.startListening(); radio.startListening();
while(!radio.available()){ while(!radio.available()){
@ -16,13 +16,17 @@
if((unsigned long)(currentMicros - start) >= 1){ if((unsigned long)(currentMicros - start) >= 1){
err = true; err = true;
}
}
/*
int16_t readData;
radio.read(&readData, sizeof(int16_t));
temperature = readData; */
} }
if(!err){ if(!err){
int16_t readData; int16_t readData;
radio.read(&readData, sizeof(int16_t)); radio.read(&readData, sizeof(int16_t));
temperature = readData; temperature = readData;
}
}
radio.stopListening(); radio.stopListening();
clearCommands(); clearCommands();
} }

Loading…
Cancel
Save