Projekte
workwind
NIBObee Probe Blue
main.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
NIBObee Probe Blue
main.cpp
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
7426 private projects
385 public projects
16180353 lines compiled
58212 builds
NIBO
@
nibobee_probe_blue/main.cpp [read only]
#include <nibobee/robo.h> #include <nibobee/usart.h> void probe_blue(uint16_t baud, uint8_t led) { int error; led_set (led, 1); usart_disable(); while (!usart_rxempty()) { usart_getchar(); } usart_setbaudrate(baud); usart_enable(); delay(200); usart_putchar('A'); usart_putchar('T'); delay(1200); //error = (usart_rxempty() || (usart_getchar()==0)); //error |= (usart_rxempty() || (usart_getchar()==0)); error = (usart_rxempty() || usart_getchar()!='O'); error |= (usart_rxempty() || usart_getchar()!='K'); led_set (led, 0); while (!error) { delay(250); led_set (led, 1); delay(250); led_set (led, 0); } } void baud_detection() { // set Tx Bit 1 PORTD |= _BV(1); DDRD |= _BV(1); IO_LEDS_PORT |= IO_LEDS_MASK; delay(1000); IO_LEDS_PORT &= ~IO_LEDS_MASK; probe_blue(9600, 0); probe_blue(19200, 1); probe_blue(38400, 2); probe_blue(57600, 3); while(1) { IO_LEDS_PORT &= ~IO_LEDS_MASK; delay(200); IO_LEDS_PORT |= IO_LEDS_MASK; delay(800); } } void echo() { PORTD |= _BV(1); DDRD |= _BV(1); while (1) { if (PIND & _BV(0)) { PORTD |= _BV(1); IO_LEDS_PORT |= _BV(0); IO_LEDS_PORT &= ~_BV(1); } else { PORTD &= ~_BV(1); IO_LEDS_PORT &= ~_BV(0); IO_LEDS_PORT |= _BV(1); } } } int main() { led_init(); feeler_init(); if (feeler_getLeft()) { echo(); } baud_detection(); }
Compiler results:
Werbung
Online
frederickajustice19
hopemiele1722452
Marinauvj
Marinavuc
sharyl94996859703161