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
7433 private projects
378 public projects
16180353 lines compiled
58212 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
adakinsey23451334
agnesmarlay2699765
alonzoneitenstein
andreasnew290004031
angelinahirsch2667
bettycarner7200
blythe489719956356
cassienajera030
catherinemccaffrey57
connorkee794434
courtneymccafferty56
dakota08q0805102416
deandnv25751532757234
dewayneo4846447140
dominiqueblakely3
elmatorrence2036594
elvialavender09
felicacooper9236
franchescamaness
gusheinig5006813136
hersheldraper36
huacorey353353214
jamilamcgarry907281
jenscorbo083215402
kathrynw31556745
kathy34q1174942
kerstinmcginnis
klaracorkill894389
lidamascorro550
louella12a3029981
lyda68o70379522
margarita650153701567
margretpettey50697721
marina42362450713
nellcarrol80211569607
ola03c531405628257
patricetooth96162311
rachelcrossley52
reneedillon5507
rolandokilgour324331
rosaline10w81270
roseannacockle5083
roxiewessel0625174
seymourlerner905090
shaneldisher04604335
shauntevieira9697
shavonnetrower2
staciewingfield769
tammarareddy0660
Victoroqr
warrenhinder6456
wolfgangmistry518270