Projekte
BirgerT
Follow Me + Maroon#1
maroon.cpp
Projekte
Forum
Doku
Öffentliche Projekte
Startseite
Beispielprogramme
Projekte von anderen
Welcome
Username
Passwort
Eingeloggt bleiben
Zugangsdaten vergessen?
Registrieren
Projektverwaltung
⇨ Please choose! ⇦
——————————————————
✎ Create new project...
★ Browse existing projects...
——————————————————
⚬ MotorTest#1
⚬ C Tutorial 8#1
⚬ NIBO2 C Project#1
⚙ C Tutorial 15#1
⚬ 2010_11_18_el_test001#1
Follow Me + Maroon#1
main.cpp
maroon.cpp
maroon.h
Project details
Compiler settings
Nachrichten
Sie sind nicht eingeloggt.
Neuigkeiten
★
NiboRoboLib 3.6
2017-01-17: Neue Version 3.6
★
NiboRoboLib 3.4.1
2016-04-16: Neue Version 3.4.1
★
Coding Tutorial
2015-11-22: Jetzt auch für den NIBO burger!
Site-Statistic
7431 private projects
378 public projects
16178582 lines compiled
58189 builds
NIBO
@
follow_me_maroon_1/maroon.cpp [read only]
#include <niboburger/base.h> #include <niboburger/iodefs.h> #include <niboburger/usart.h> #include <niboburger/motpwm.h> #include <niboburger/motpid.h> #include <niboburger/analog.h> #include <niboburger/odometry.h> #include <niboburger/led.h> #include <niboburger/key.h> #include <niboburger/delay.h> #include <niboburger/surface.h> #include <niboburger/color.h> #include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include <string.h> #include <stdlib.h> #include "maroon.h" uint16_t maroon_cnt; uint8_t maroon_mode; char maroon_gfxdata[] = MAROON_LOAD() MAROON_BAR("00000000"); #define MAROON_BAR_OFFSET 4 void maroon_bars(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g, uint8_t h) { if (usart_txempty()) { maroon_gfxdata[MAROON_BAR_OFFSET+0] = a; maroon_gfxdata[MAROON_BAR_OFFSET+1] = b; maroon_gfxdata[MAROON_BAR_OFFSET+2] = c; maroon_gfxdata[MAROON_BAR_OFFSET+3] = d; maroon_gfxdata[MAROON_BAR_OFFSET+4] = e; maroon_gfxdata[MAROON_BAR_OFFSET+5] = f; maroon_gfxdata[MAROON_BAR_OFFSET+6] = g; maroon_gfxdata[MAROON_BAR_OFFSET+7] = h; usart_write(maroon_gfxdata); } } void maroon_setup() { usart_setbaudrate(38400); usart_enable(); } void maroon_welcome() { maroon_mode=0; usart_write(MAROON_IMM_CLEAR() MAROON_BRIGHT(0) MAROON_LOAD() "1" MAROON_BAR("0") MAROON_DIM(*) MAROON_PAUSE(100) MAROON_DIM(5) MAROON_STIME(60) " Follow me\n" MAROON_TXBACK(".")); } char getSensorChar(int16_t val) { if (val<5) return 'a'; if (val<10) return 'b'; if (val<15) return 'c'; if (val<25) return 'd'; if (val<35) return 'e'; if (val<50) return 'f'; if (val<70) return 'g'; if (val<100) return 'h'; return 'i'; } void maroon_loop() { if (!usart_rxempty()) { char c = usart_getchar(); if (c=='.') { maroon_mode = 1; } } if (maroon_mode) { if (maroon_cnt) { maroon_cnt--; return; } maroon_cnt=20; if (usart_txempty()) { #if 0 char l = getSensorChar(analog_getValueExt(ANALOG_FL, 2)); char r = getSensorChar(analog_getValueExt(ANALOG_FR, 2)); char ll = getSensorChar(analog_getValueExt(ANALOG_FLL, 2)); char rr = getSensorChar(analog_getValueExt(ANALOG_FRR, 2)); #else // BirgerT: etwas Kosmetik, damit das MAROON die normalisierten Distanzwerte anzeigt extern uint16_t brick_offset[]; char l = getSensorChar(analog_getValueExt(ANALOG_FL, 2) - brick_offset[ANALOG_FL]); char r = getSensorChar(analog_getValueExt(ANALOG_FR, 2) - brick_offset[ANALOG_FR]); char ll = getSensorChar(analog_getValueExt(ANALOG_FLL, 2) - brick_offset[ANALOG_FLL]); char rr = getSensorChar(analog_getValueExt(ANALOG_FRR, 2)) - brick_offset[ANALOG_FRR]; #endif maroon_bars(rr, '0', r, '0', '0', l, '0', ll); } } } uint8_t maroon_connected() { return maroon_mode; }
Compiler results:
Werbung
Online
andreasnew290004031
Banane
blairembley00135154
chandradillion322729
deandnv25751532757234
dianeiek83169264258
drusillapayne578806
elberttelfer568
elissa90h1495041949
elvialavender09
harold532781508
hersheldraper36
jamierapp475936
janellegard4477
margenebales8570025
NAnakaka
natashamoyes64624093
shaneldisher04604335
shellachen05598945
warrenhinder6456
zackirvin72719811111