1/11
Flashcards covering key concepts from the C/C++ CODAL lecture, focusing on event handling, temperature sensing, and data logging on the MicroBit.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
How can button presses be detected on the MicroBit?
Using uBit.buttonA and uBit.buttonB, which are instances of the MicroBitButton class. uBit.buttonAB detects combined input and is an instance of MicroBitMultiButton.
What does the isPressed() method return?
It returns 1 (true) if the corresponding button has been pressed, otherwise it returns 0 (false).
What is the purpose of MicroBitMessageBus class?
To listen to events and deliver MicroBitEvents to the program as they occur, calling an event handler function when an event of interest is detected.
What is an event handler in the context of MicroBit programming?
A function that is called by the MicroBitMessageBus class when an event of interest is detected.
What are the three inputs required for setting up Listeners for buttons using uBit.messageBus.listen?
ID of component to listen to, event of interest, and the event handler to be called if the event is raised.
What is the purpose of the MicroBitThermometer class?
To provide access to the surface temperature of the application MCU.
How can the MicroBitThermometer be calibrated?
By using uBit.thermometer.setCalibration(readTemp - ambientTemp), where readTemp is the initial reading and ambientTemp is the known ambient temperature.
How can the sampling period for the thermometer be defined in asynchronous mode?
Using uBit.thermometer.setPeriod(time in ms).
What functionality does the MicroBitLog class provide?
Enables storing data in a table-like format, containing rows of readings or other types of data.
What methods are used with the MicroBitLog class?
beginRow(), logData("label of column", value to log), endRow(), setTimeStamp(TimeStampFormat::Seconds), setVisibility(true), isFull(), and clear().
What is the purpose of uBit.log.setTimeStamp(TimeStampFormat::Seconds)?
To add a time stamp to each log entry, enabling the creation of plots of the recorded values.
How can the log file created by MicroBitLog be made visible?
By including the line uBit.log.setVisibility(true).