Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BusOut Programm
Informationen über die BusOut-Schnittstelle findet man in den Slides 1 bis 8 von parallel data and communication. Das folgende Programm stammt aus der Mbed-OS Docs; Lade das Programm Blinky with BusOut im Mbed-Simulator:
BusOut.cpp
#include "mbed.h" BusOut myleds(LED1, LED2, LED3, LED4); int main() { while(1) { for(int i=0; i<16; i++) { myleds = i; wait(0.25); } } }
Es kann jeder der nummerierten Arm-Mbed-Pins als DigitalOut im BusOut verwenden.
Import programBusInOut
BusIn to BusOut; Joystick to 4 blue Leds
Aufgabe¶
- Ändern Sie das Programm, sodass der Joystick-Zustand als Ausgangsbasis für einen Count-Down im Sekundentakt dient und am Ende alle Leds wieder verloschen sind.
- Kodieren Sie den Joystick-Wert auf die jeweilige Pinnummer und geben diese auf die Leds binär aus (up = p15, alle Leds leuchten, usw. p16 wird zu 0001).
Tipps:
Es können bis zu 16 Pins in einem Bus verwendet werden. Die Reihenfolge der Pins im Konstruktor ist die umgekehrte Reihenfolge der Pins in der Bytereihenfolge. Wenn Sie also BusOut (a, b, c, d, e, f, g, h) haben, dann wäre die Reihenfolge der Bits im Byte hgfedcba, wobei a Bit 0 ist, b Bit 1 ist, c Bit 2 ist, usw.