Solution

Dependencies:   mbed

Fork of Task352Solution by Stage-1 Students SoCEM

Committer:
noutram
Date:
Tue Oct 02 07:37:08 2018 +0000
Revision:
1:facc2bd1d423
Added solution to tasks

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 1:facc2bd1d423 1 Answer to questions
noutram 1:facc2bd1d423 2
noutram 1:facc2bd1d423 3 Q1. 1 second
noutram 1:facc2bd1d423 4 Q2. XOR
noutram 1:facc2bd1d423 5 Q3. D3
noutram 1:facc2bd1d423 6
noutram 1:facc2bd1d423 7 Q4. This project is one possible solution
noutram 1:facc2bd1d423 8
noutram 1:facc2bd1d423 9 The key line is this
noutram 1:facc2bd1d423 10
noutram 1:facc2bd1d423 11 unsigned int binaryInput = SW1 + (SW2 << 1);
noutram 1:facc2bd1d423 12
noutram 1:facc2bd1d423 13 where SW1 and SW2 are the switches for the least and most significant bits respectively.
noutram 1:facc2bd1d423 14
noutram 1:facc2bd1d423 15 Note the use of << to multiply by 2. A left shift is a cheap operation in computing terms (does not require many CPU cycles).