Projekte
Robert
Fraidy Cat + 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
Fraidy Ca... Maroon#1
main.cpp
maroon.cpp
maroon.hpp
newfile1.c
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
@
fraidy_cat_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.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() "2" MAROON_BAR("0") MAROON_DIM(*) MAROON_PAUSE(100) MAROON_DIM(5) MAROON_STIME(60) " Fraidy Cat\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
alicevib4869957876
andreasnew290004031
armanddelatorre8855
bettycarner7200
blythe489719956356
bvkdarrel629626
carinstultz4050
carollamson4653652
cassienajera030
catherinemccaffrey57
chandradillion322729
christell796644475029
clemmielcg304935418
courtneymccafferty56
dakota08q0805102416
deborabarksdale798
edisonlizotte4427
effiebailey1301319
elbawymark1984175
elberttelfer568
elisabroadus2257
ellismclane316891531
elvialavender09
emersonweir268525
felicacooper9236
fgvilana9831165538
floygorman01636663
giaburroughs46893
gusheinig5006813136
horacebatiste02630
jamilamcgarry907281
janellegard4477
janetitg188521920
jeffryaiello27385282
jenscorbo083215402
jewelljeffers169
jorgesteiner63401957
kathlenehorst156247
kendrazeigler82
kerstinmcginnis
kristeenchaves915
KylieSat
latoyasorenson155
lee72827156077981
leliabaughan2211
lenardamiet3598464
lidamascorro550
loriniles410565581
loviematthies002
luciehateley133886
margarita650153701567
margretpettey50697721
maribeleverard3
Marinavuc
melisacastiglia060
moshegether2103369
natashaappleton130
nellcarrol80211569607
nganbolton343216575
odettesear36035
patricetooth96162311
reneedillon5507
rolandokilgour324331
rongair39316288
roxiewessel0625174
seymourlerner905090
shaneldisher04604335
shantaebice4945737509
silkemerrett05515
staciewingfield769
tammarareddy0660
tiffaniscott025
torriarscott25066
veldawlh81514495
warren38l1013290
warrenhinder6456
williepinkston9240
wolfgangmistry518270