Digital Systems: C/C++ CODAL (Part 2)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/11

flashcard set

Earn XP

Description and Tags

Flashcards covering key concepts from the C/C++ CODAL lecture, focusing on event handling, temperature sensing, and data logging on the MicroBit.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards

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.

2
New cards

What does the isPressed() method return?

It returns 1 (true) if the corresponding button has been pressed, otherwise it returns 0 (false).

3
New cards

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.

4
New cards

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.

5
New cards

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.

6
New cards

What is the purpose of the MicroBitThermometer class?

To provide access to the surface temperature of the application MCU.

7
New cards

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.

8
New cards

How can the sampling period for the thermometer be defined in asynchronous mode?

Using uBit.thermometer.setPeriod(time in ms).

9
New cards

What functionality does the MicroBitLog class provide?

Enables storing data in a table-like format, containing rows of readings or other types of data.

10
New cards

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().

11
New cards

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.

12
New cards

How can the log file created by MicroBitLog be made visible?

By including the line uBit.log.setVisibility(true).