Projekte
AitanaAlmaguer
Hindernisse ausweichen
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
Hindernis...usweichen
main.cpp
maroon.cpp
maroon.hpp
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
7494 private projects
385 public projects
16433021 lines compiled
58481 builds
NIBO
@
hindernisse_ausweichen/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.hpp" uint16_t maroon_cnt; uint8_t maroon_mode; char maroon_gfxdata[] = MAROON_LOAD() MAROON_BAR("00000000"); #define MAROON_BAR_OFFSET 4 void maroon_bars(char a, char b, char c, char d, char e, char f, char g, char 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() MAROON_BAR("0") MAROON_DIM(*) MAROON_PAUSE(100) MAROON_DIM(5) MAROON_STIME(60) " Taster 1 drücken\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()) { 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)); maroon_bars(rr, '0', r, '0', '0', l, '0', ll); } } }
Compiler results:
Werbung
Online
alexisatwood977
cheryleupr40389044
leiamccourt8290302029
PromotionNow
stantonstaten693