Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

2.4 Write codes in the void setupre to initialise the following:
(a) Initialise the Serial port to operate at 9600bps;
(b) Digital pin D2, D3 and D12;
(c) Wait for swo 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 ()
f
// if the reading from PIR motion is HIGH
// Sound the Pizea buzzer
I/ Send a message 'x' To Bluetooth
}
(3 marks)
3(a) Write codes to set bit 5 and bit 7 of the 8-bit variable swNal to 1, with the rest of the bits of swyal remains unchanged
(b) Write codes to clear bits 2,5 and 6 of the 8-bit variable aumkal to 0, with the rest of the bits of numval 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.
(b) Write C-Statements to print the value of num on Serial Monitor as shown in Figure 1.1.
Figure 1.1
where NNNNNNNN is the value of num in binary after executing 4(a)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions

Question

Design a training session to maximize learning. page 296

Answered: 1 week ago

Question

Design a cross-cultural preparation program. page 300

Answered: 1 week ago