Question: 2 . 4 Write codes in the void setupl to initialise the following: ( a ) Initialise the Serial port to operate at 9 6

2.4 Write codes in the void setupl to initialise the following:
(a) Initialise the Serial port to operate at 9600bps;-
(b) Digital pin D2, D3 and D12;
(c) Wait for SW0 to be press; and
(d) Send 2 characters '8' followed by 'S' via serial port to the Bluetooth module.
For (c) and (d), you are to call the respective functions in 2.1 and 2.3
(8 marks)
2.7 Write codes in the forever loop assisted by the following comments: You are to declare any variables you used.
void loop ()
// if the reading Erom PIR motion ia HIGH
// Sound the pizea buzzer
// Send a message 'x' To Bluetooth
+
(3 marks)
3(a) Write codes to set bit 5 and bit 7 of the 8-bit variable swVal to 1, with the rest of the bits of swdal,remains unchanged
(b) Write codes to clear bits 2,5 and 6 of the 8-bit variable numV a to 0, with the rest of the bits of pumbal. remains unchanged
4
(a) If the initial value in the variable num is 016, what will be the new value in the variable num after executing the following instruction? Show your working as necessary
num =( num 1)100;
(b) Write C-Statements to print the value of num on Serial Monitor as shown in Figure 1.1
Figure 1.1
Where NNNNNNNNN is the value of num in binary aner executing 4(a)
 2.4 Write codes in the void setupl to initialise the following:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!