Principles of Engineering
Lab: What Affects Pricing?
Materials:
1. Three types of candy (A, B, C) with the following quantities for each team
Candy A 3 pieces for half the groups
4 pieces for the other groups
2 pieces to add to the game later
Candy B 4 pieces for each group
Candy C 4 pieces for each group
2. Bags to hold candy for each team
3. Packet of money for each group with variety of small denominations totaling $100 per
group
4. Worksheet
Goal
A hurricane has wiped out all sugar cane fields and no candy can be produced at this time.
The goal of the game is for each team to end up with three different types of candy and as much
money as possible
How to Play
1. Each team of students takes a bag of candy containing eight or nine pieces of Candies A,
B, and C. Half the bags will only contain three of Candy A. Each team also receives a packet
of bills equaling $100.
2. Buy and sell freely from each other during the game period. One person serves as the
accountant for each team to record transactions and inventory. Halfway through the
game the teacher will auction off two additional pieces of Candy A.
3. The game will end at a pre-announced time and the results will be tallied.
Transaction # Qty (+ or -) Candy Type Price
1
2
3
4
5
6
7
8
9
10
11
CIJE | Unit 18: Entrepreneurship 251
Principles of Engineering
4. Final Team Tally. Remaining:
Candy A Candy B Candy C Money
5. Cost Candy A Candy B Candy C
From your transaction sheet above, calculate the
average amount you paid for:
Average amount paid by the class:
6. “Sell” your remaining candy for the average class price. Record your total income $____
Questions
7. What are three things that affect pricing?
_________________________________________________________________________
8. Did the price of candy change over the course of the game?
_________________________________________________________________________
9. Which candies had the largest fluctuation in price?
_________________________________________________________________________
10. Was Candy A worth more at the end of the game? Why or why not?
_________________________________________________________________________
11. What was the strategy of the winner (obtain candy or money)? What affected this
strategy?
_________________________________________________________________________
12. Why do people pay more for a Jaguar than a Ford?
_________________________________________________________________________
13. How would you play the game differently if you were to do it again?
_________________________________________________________________________
252 Unit 18: Entrepreneurship | CIJE
Appendix A –
Binary
Principles of Engineering
Binary
Why do you suppose Arduino prints out a number from 0 to 1023 when using analogRead instead
of just reporting the actual voltage? As we discussed in the section on integer overflow,
computers, including the Arduino, work only with binary number. In this next section we will
discuss how to convert decimal numbers into binary numbers so that we can better understand
what is going on inside the processor.
The number system we are most familiar with is decimal numbers, called “base 10". This means
we have 10 different digits to work with. We can count from 0 to 9 and then we have to start
over. When we consider a number like 324 for example, the location of the 3, 2 and 4 are very
important. Each digit is 10 times the value of the digit next to it on the right. 324 means 300 +
20 + 4. Note, the 2 in 324 means a larger value than the 4 because of where it is located.
What if we didn’t have 10 digits? The processor doesn’t. It only has 2 possibilities, High and Low.
That means it can only count 0 or 1 and then it has to start over. In the processor, we use binary
numbers. Let’s count in binary:
0, 1, 10, 11, 100, 101, 110, 111, 1000
Do you see the pattern? What comes next? __________________
In base 10 numbers (decimal) we have 10 digits so each place as we move right to left is 10 times
the value of the previous position.
100's 10's 1's
In binary (base 2) we only have 2 digits (0 and 1) so each place as we move right to left is 2 times
the value of the previous. Each place is the next power of 2. After 8 (23) we have 16 (24).
8's 4's 2's 1's
Consider the number 1011. We have three 1s and a 0, but these are not all the same since they
are in different places. 1011 has a '1', a '2', no '4' and an '8'. Can you calculate what this number
would be in decimal?
1011
8421
1011 = __________________
The answer is 11, gotten by adding 1 + 2 + 8. We don't add 4 because there isn't a 1 in the 4
position.
Let’s try another one: 0101 = __________________
254 Appendix A – Binary | CIJE
Principles of Engineering
We can look at bigger numbers but we will need a bigger table.
1024 512 256 128 64 32 16 8 4 2 1
What is the binary number 00110010 = __________________ 0
0011001
128 64 32 16 8 4 2 1
It has a 2, no 4 or 8, a 16 and a 32 no 64, or 128
In the processor, each digit requires an electronic circuit that can store either 1 or 0. When a
processor is designed it must be decided how many of these circuit to put in each location. More
circuits allow you to use bigger numbers, but they make the processor more expensive to build.
In the above example, there is a leading 0 on the number. Many numbers in the processor are 8
bit numbers, meaning they must use 8 bits to represent the number. Remember, the hardware
is there. It has to be either 0 or 1, so leading 0s are very common.
Recall when we previously discussed integer sizes for the different data types (e.g., char, int, long,
etc.) that with 8-bits, we can only have 28 (that is, 256) possible numbers. Similarly with 16-bits
we have 216 possible numbers.
For the analog-to-digital converter that is used to convert voltages on the analog pins when we
use analogRead(), the Arduino processor was designed with only 10 binary circuits that could
contain 1 or 0, meaning that it is a 10-bit converter. What is the highest possible number that can
be stored in a 10-bit converter?
CIJE | Appendix A – Binary 255
Principles of Engineering
Lab: Section 16 - Binary
1024 512 256 128 64 32 16 8 4 2 1
1. What is the largest number (base 10) that can be represented using:
a. 1 binary digits? _____________________________
b. 4 binary digits? _____________________________
c. 5 binary digits? _____________________________
d. 8 binary digits? _____________________________
e. 10 binary digits? _____________________________
2. Determine if the following binary numbers are odd or even:
a. 1101001010101 _________ f. 001 _________
b. 1 _________ g. 100 _________
c. 11 _________ h. 1010101010101 _________
d. 111 _________ i. 0000000000001 _________
e. 0 _________ j. 1000000000000 _________
3. Complete the following:
a. 24 in decimal is equal to ____________________ in binary.
b. 11 in decimal is equal to ____________________ in binary.
c. 789 in decimal is equal to ____________________ in binary.
d. 1,234 in decimal is equal to ____________________ in binary.
e. 2,723 in decimal is equal to ____________________ in binary.
f. 0 in decimal is equal to ____________________ in binary.
4. Complete the following:
a. 11 in binary is equal to ____________________ in decimal.
b. 100110 in binary is equal to ____________________ in decimal.
c. 1011 in binary is equal to ____________________ in decimal.
d. 1000 in binary is equal to ____________________ in decimal.
e. 10 in binary is equal to ____________________ in decimal.
f. 11000101 in binary is equal to ____________________ in decimal.
256 Appendix A – Binary | CIJE
Appendix B –
Unit Conversion
and Dimensions
Principles of Engineering
Preface
Mathematics is the main language of engineering when describing and analyzing phenomena in
terms of quantity. During the course, we will learn about several important elements of this
language. In this unit, we will look at the action of the exponent, which is very useful in the
different ways it can represent and describe scientific and engineering phenomena. During the
course, we will use these forms of representation in different content areas.
Unit Sections:
➢ Exponents
➢ Dimensions and Units of Measurement
➢ Worksheet: Unit Conversion
Learning objectives
After this unit students will be able to:
➢ Calculate values with exponents
➢ List the dimensions used to describe the physical world
➢ Be able to convert decimal numbers to scientific notation and back
➢ Convert between key units of measurement
258 Appendix B – Unit Conversion and Dimensions | CIJE
Principles of Engineering
Exponents
You know about the four arithmetical operations: addition, subtraction, multiplication and
division. Why do we use multiplication? We know that this is a shortened way of doing addition.
In order to know how many floor tiles there are in a room or to calculate the area of a room, we
use multiplication.
Now consider a more difficult problem. Imagine that we want to know how many bacteria there
are in a colony that began with a single bacterium that divides every minute. After one minute
the colony will have 1 · 2 = 2 bacteria. After two minutes, there will be 2 · 2 = 4. After three
minutes, there will be 4 · 2 = 8 bacteria.
How many bacteria will there be after 10 minutes?
We can calculate it by multiplying the number 2 by itself 10 times: 2 · 2 · 2 · 2 · 2 · 2 · 2 · 2 · 2 · 2 =
1024
Now what will we do if we want to know the size of the colony after one hour? We will have to
multiply 2 by itself 60 times…. That’s a huge number!
This is where it is helpful to use an operation that is an abbreviation of multiplication – the
exponent.
The exponent is an operation performed between two numbers:
One is called the “base” and the other is called the “power”.
An exponent is written thus: ab, where a is the base and b is the power.
When the power is a natural number (1,2,3…) the meaning of the exponent operation is an
abbreviation of the multiplication, in other words, the number is multiplied by itself, the number
of times equal to the power:
an = a x ... x a
n times
For example:
24 = 2 · 2 · 2 · 2 = 16
43 = 4 · 4 · 4 = 64
One special case is when the power is 2, and then we usually call it “squared” since the area of
the square is the length of a side to the power of 2.
For example, ‘5 squared’ means 52.
In terms of the order of arithmetic operations, the exponent precedes the other four. A base
number to the power of 0 (zero) is defined as equal to 1: a0 = 1
When the power is a negative integer, or in other words, the opposite of a natural number
(-1, -2, -3…) the meaning of the operation is the reciprocal of a positive exponent
CIJE | Appendix B – Unit Conversion and Dimensions 259
Principles of Engineering
Dimensions and Units of Measurement
A dimensionless number is a pure representation of quantity.
Take the number 42 for example. Is it a number of chairs? Your position in line? A force being
applied downward on a scale? It could be anything.
Isaac Newton defined the laws of physics based on three fixed kinds of quantities in the physical
world.
There is mass, the amount of material, which you experience in earth's gravity as a weight. There
is distance, or length. And there is time.
A unit of measurement (or “unit” for short) is a convention used to measure a particular
dimension.
There can be many units describing one dimension.
For example, to describe length, people have devised units such as the meter, foot, inch, mile,
and so on. People have done this for thousands of years. For example, the tanach mentions the
cubit (amah).
The units that developed ad hoc such as the English system tend to have odd numbers, making
them more difficult to calculate. For example, in the English system, there are inches, feet, yards,
and miles.
But converting between them is not very convenient, as there are: 12 inches in a foot, 3 feet in a
yard, 5280 feet in a mile = 1760 yards, etc.
Why do we even have units like miles? Can't everything simply be in the smallest units? You could
say, for example, that it's 162,585 inches from home to your school. The problem is the numbers
can be either ridiculously large or small. Therefore, we like to use a unit for a particular context
that is on the scale of the thing we are measuring, to keep the numbers reasonable.
In the French revolution, the new government decided to rationalize measurement. To make it
easier, they adopted a single unit of length (the meter) and defined prefixes and suffixes for
bigger and smaller numbers. So, if you are studying an insect, you might discuss its size in
millimeters (1/1000ths of a meter), while if you are designing a racetrack, you might talk in terms
of kilometers (1000’s of meters).
The French system of measurement (now an international standard called System International,
or SI) won everywhere in the world except the United States. Even here, for all science, and most
engineering, SI is used, and in this course, we will use it exclusively.
However, it's worth knowing that in some limited contexts, the original French system did not
win. The designers of SI wanted everything to be powers of 10, but for time, it was just too
inconvenient. People have been using 7 day weeks, 24 hour days and 365 days a year for
thousands of years, and so, for time alone, the "second" is the only SI unit. It is subsequently
translated in to days and hours based on universal convention.
Since you are familiar with the English system of measurement, occasionally a translation will be
provided for you, only so you have a sense of what the numbers mean in an unfamiliar scale. For
example, if we talk about meters, you might not know exactly what it means, so we might
260 Appendix B – Unit Conversion and Dimensions | CIJE
Principles of Engineering
occasionally write the equivalent in a unit you are familiar with, for example, 10 meters (30.33
feet).
One meter = 39.37 inches. One inch = 2.54 centimeters.
But for the best understanding, you need to begin using SI units directly and understand what
they mean.
Calculate your height in meters. ____________________
Calculate your weight in kg. ____________________
What is the mass of an orange in kg? ____________________
How fast (in kph) is a 65-mph car travelling? ____________________
How many kilometers would a jogger travel if he jogged 10 miles? _______________
Just as with speaking a foreign language, the best way to learn is not to translate it into your
language, but learn to associate the word with a mental model of what it means.
The basic units of measurement in SI are listed in the table below. The first three, you probably
know, and the other three will become familiar soon.
Dimension Unit Abbreviation
Length meter m
Mass kilogram kg
Time second s
Current Ampere A
Temperature Kelvin K
Intensity candela c
The SI system was formally ratified in 1948.:
There are also many derived units which involve combinations of the above, some (not all) are
listed here:
Dimension Unit Abbreviation Whenever a unit in SI is named for a physicist
Force Newton N who studied the area, the unit name and
Energy Joule J abbreviation are capitalized.
Potential Volt V Whenever a unit is too big or too small for
Power Watt W practical use, we can use a standard SI prefix.
Velocity meters/sec m/s The following is a table of prefixes. Note that
the unit gram was not sufficiently large for
convenience, and so the base unit of SI is the kilogram (1000 grams).
CIJE | Appendix B – Unit Conversion and Dimensions 261
Principles of Engineering
So, for example:
• The width of a human hair is about .00001 meters, or 10 um.
• A car weighs about 1,000,000 grams, or 1000 kg.
• A lightning strike releases on the order of 1,000,000,000 Joules, or 1GJ (a GigaJoule).
• The total installed electrical generating capacity in the United States is approximately
1,000,000,000,000 Watts, or 1TW.
• The power used by a digital thermometer is on the order of .00003 Watts, or 30 uW
(microWatts).
Exercise – Unit conversion
Fill in the table: Convert the dimensions in the left column into the various units on the right:
262 Appendix B – Unit Conversion and Dimensions | CIJE
Principles of Engineering
Work sheet – Unit Conversion
Exponents Appropriate
exercise
1. Fill in the table below:
Exponent Exponent Power of the
notation base exponent
1. 63
2. 8 2
3. 1 x 1 x 1 x 1 x 1
4. 25
5. 4 9
6. 8 x 8 x 8
2. Write down the following numbers without using the scientific form of exponents:
a) 1.28 * 103 = __________________________
b) 1.28 * 10-2 = __________________________
c) 1 * 10-5 = __________________________
d) -3.2 * 10-3 = __________________________
3. Write down the following numbers without the use of prefixes, as shown in the first
example:
a) Three kilograms = 3,000 grams
b) Ninety-three milligrams = ________________ grams
c) Half of a milligram = ________________ grams
d) Nine thousand milligrams = ________________ grams
e) Half of a kilogram = ________________ grams Prefi Symbol 10n Decimal
mega M X 106 1000000
f) Seven kilo-ohms = ________________ ohms kilo K X 103 1000
centi C X 10−2 0.01
g) Half of a kilo-ohms = ________________ ohms milli m X 10−3 0.001
h) Nine mega-ohms = ________________ ohms
i) Seventy seven milli-amps = ________________ amps
j) Half of a milli-amp = ________________ amps
k) Three milli-amps = ________________ amps
l) Three thousand milli-amps = ________________ amps
CIJE | Appendix B – Unit Conversion and Dimensions 263
Principles of Engineering
Unit conversion 1 pound = 454 grams
4. Complete the unit conversion table below
1 foot = 12 inches
a) 23 feet = __________ inches b) 1.75 pounds = __________ grams
c) 3.5 feet = __________ inches d) .5 pounds = __________ grams
e) 9 inches = __________ feet f) 681 grams = __________ pounds
g) 96 inches = __________ feet h) 227 grams = __________ pounds
Dimensions
5. Complete the table below by converting the units into the SMALLER dimensions
a) 1.234 MΩ = _____________ Ω b) 1.234 kΩ = _____________ Ω
c) 7 MΩ = _____________ Ω d) 7 kΩ = _____________ Ω
e) 1.2 MΩ = _____________ Ω f) 1.2 kΩ = _____________ Ω
g) 0.700 MΩ = _____________ Ω h) 700 kΩ = _____________ Ω
i) 1.000003 MΩ = _____________ Ω j) 1.003 kΩ = _____________ Ω
k) 0.000001 MΩ = _____________ Ω l) 0.001 kΩ = _____________ Ω
6. Complete the table below by converting the units into the LARGER dimensions
a) 1,234 Ω = _____________ MΩ b) 1,234 Ω = _____________ kΩ
d) 7,000 Ω = _____________ kΩ
c) 7,000,000 Ω = _____________ MΩ f) 1.2 Ω = _____________ kΩ
h) 1,234 Ω = _____________ kΩ
e) 1.2 Ω = _____________ MΩ j) 1.003 Ω = _____________ kΩ
l) 1 Ω = _____________ kΩ
g) 700,000 Ω = _____________ MΩ
i) 60,234 Ω = _____________ MΩ
k) 1 Ω = _____________ MΩ
264 Appendix B – Unit Conversion and Dimensions | CIJE
Principles of Engineering
7. Complete the table below by converting the units
a) 1 A = _____________ mA b) 1 mA = _____________ A
c) 1.1 A = _____________ mA d) 1,000 mA = _____________ A
e) 0.1 A = _____________ mA f) 1.2 mA = _____________ A
g) 0.0003 A = _____________ mA h) 1,234 mA = _____________ A
i) 1.01010 A = _____________ mA j) 10,567 mA = _____________ A
k) 1,000 A = _____________ mA l) 0.001 mA = _____________ A
8. Select the setting on the Digital Multimeter you would most likely use when measuring
the following:
NOTE: The settings connote the largest measurement you can sense on that setting
_________ a) The voltage of a single AA battery (1.5 V) 2000 mV
_________ b) The voltage in a 4xAA battery pack (6V) 20 v
_________ c) The voltage of a 9V battery 200 v
_________ d) The voltage of an unknown power supply 200 Ω
_________ e) The current through an LED 2 kΩ
_________ f) The current in a 3 amp circuit 20 kΩ
_________ g) The resistance of a 1,900,000 Ω resistor 20 mA
_________ h) The resistance of a 3 Ω resistor
_________ i) The resistance of a 20,550 Ω resistor 200 mA
_________ j) The resistance of an unknown resistor 2000 mA
20 A
CIJE | Appendix B – Unit Conversion and Dimensions 265
Principles of Engineering
9. Below are images of Digital Multimeter screens, used to measure Voltage, Current and
Resistance of electrical circuits. Based on the information given on the screen, indicate
the amount of volts or ohms being measured.
__________ V __________ V
__________ V __________ V
__________ V
__________
Ω
__________ V __________ V
__________ Ω __________ V
__________ V __________ V
266 Appendix B – Unit Conversion and Dimensions | CIJE
Appendix C –
LCD Display
Principles of Engineering
Lab: LCD Display
Wiring
To use this type of LCD directly with Arduino, you would need 6
pins: RS, EN, D7, D6, D5, and D4 to talk to the LCD. If you are doing
more than a simple project, you may be out of pins using a normal
LCD shield. With this I2C interface LCD module, you only need 2
pins (I2C) to display information. If you already have I2C devices in
your project, this LCD module actually uses no more pins at all.
This unit connects with 4 wires including Vcc and Gnd.
GND - GND
VCC - 5V
SDA - ANALOG Pin 4
SCL - ANALOG pin 5
On most Arduino boards, SDA (data line) is on analog input pin 4, and SCL (clock line) is on
analog input pin 5. On the Arduino Mega, SDA is digital pin 20 and SCL is 21.
NOTE: The Blue Potentiometer (Photo) adjusts Contrast. If you don't see any characters,
adjust it. Start clockwise and back down to where the characters are bright and the
background does not have boxes behind the characters.
Installing Libraries
This type of screen uses an Arduino Library. To install the library:
1. Open the Arduino Library
Manager:
2. Search for “liquidcrystal
i2c” and install the library
by Frank de Brabander
268 Appendix C – LCD Display | CIJE
Principles of Engineering
Code
To use the LCD screen in your Arduino code, insert the following lines:
Above "void setup()" insert
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
In the "void setup()" insert
lcd.init();
In the "void loop()" you could use some of the following commands
➢ lcd.backlight(); // will turn on the blue backlight
➢ lcd.noBacklight(); // will turn off the blue backlight
➢ lcd.clear(); // will clear the screen
➢ lcd.setCursor(0,0); // moves the cursor to location (x,y)
➢ lcd.print("Hello,world!"); // prints "Hello, world!"
➢ lcd.print(x); // prints the value of x on the screen
For Example
If you had an integer "x" and it was equal to 96:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Hello, ARDUINO");
lcd.setCursor(0,1);
lcd.print(x);
would display the following on your screen
Questions
Complete the following questions in your journal
1. What is the I2C communication interface?
2. What are some of the benefits of the I2C protocol?
3. What is an Arduino library?
4. What are some benefits to using an LCD screen over Serial.println?
5. How much power (watts = volts x amps) does your LCD screen use?
6. Is it possible to connect two screens to an Arduino even though there is only one set of
I2C pins? If so, how?
CIJE | Appendix C – LCD Display 269
Appendix D –
RF
Transmitter
Principles of Engineering
Lab: RF Transmitter
Introduction
In this lab, we will experiment sending variables from one Arduino to another using Radio
Frequency (RF) transmission. One Arduino and RF Transceiver will act as the transmitter (i.e. -
sender) while another Arduino and RF Transceiver will act as the receiver.
Array
Rather than sending one variable at a time, the transmitter will send an array of variables. An
array is series of variables stored within one variable name. For example, we can use a variable
called 'engineering' and store five variable within it:
int engineering[5] = {2, 4, 8, 3, 6};
The variable 'engineering' is actually storing five independent variables. To use the variable, we
can refer to them independently by counting which space in the array it is occupying, starting
from zero. For example:
x = engineering[0]; //would set the value of x equal to 2
x = engineering[4]; //would set the value of x equal to 6
To store characters in the array we declare it as a 'char' type. Note: to store characters we must
add one more space to the array than in necessary to contain our characters. For example we
need a 6 space array to store a 5 letter word:
char message[6] = "hello"; //message[1] would equal the letter 'e'
Wiring
Orient the chip with the antenna on the left and the silver oval oscillator on the top. Note the
pin numbering in the image to the right.
1 – GND to ground
2 - VCC to 5V
3 - CE to Arduino pin 9
4 - CSN to Arduino pin 10
5 - SCK to Arduino pin 13
6 - MO to Arduino pin 11
7 - MI to Arduino pin 12
8 - UNUSED
Installing Libraries
This type of RF uses an Arduino Library.
Instructions for installing the library can be
found in the previous lab, LCD Screens.
CIJE | Appendix D – RF Transmitter 271
Principles of Engineering
Coding Receiver
Transmitter Before 'void setup()'
Before 'void setup()' // Import installed libraries
#include <SPI.h>
// Import installed libraries #include <nRF24L01.h>
#include <SPI.h> #include <RF24.h>
#include <nRF24L01.h> // The 'pipe' or 'frequency'
#include <RF24.h> // Same for sender and receiver
// The 'pipe' or 'frequency'
// Same for sender and receiver const uint64_t pipe = 0xE8E8F0F0E1LL;
const uint64_t pipe = 0xE8E8F0F0E1LL; // Declare object & Create Radio
RF24 radio(9, 10);
// Declare object & Create Radio //Declare Variable 'rocket'
RF24 radio(9, 10); //as a 2 element array
//Declare Variable 'elephant' int rocket[2];
//as a 2 element array
int elephant[2]; In the 'void setup()'
In the 'void setup()' radio.begin();
radio.openReadingPipe(1,pipe);
radio.begin(); radio.startListening();
radio.openWritingPipe(pipe); Serial.begin(9600);
In the 'void loop()' In the 'void loop()'
// give 'elephant' a value,e.g.: //read the incoming radio signal
elephant[0] = analogRead(A0); //store the information in
elephant[1] = 7; 'rocket'
// send 'elephant' radio.read(rocket, sizeof(rocket));
// print the values of 'rocket'
radio.write(elephant, sizeof(elephant)); Serial.print(rocket[0]);
Serial.println(rocket[1]);
Tone Function
For a speaker to produce sound, a diaphragm, or cone, must vibrate at a high frequency. The
vibrating diaphragm causes sound waves to be produced in the
air that travel to our ear drums. Arduino has a built in function
called 'tone' that can be used to vibrate a speaker plugged into
a digital pin. The syntax is as follows:
tone(pin #, frequency)
Piezo Speaker
272 Appendix D – RF Transmitter | CIJE
Principles of Engineering
Challenge
The goal of the activity is to create a wireless keyboard to play simple songs
Procedure
1. Wire 4 buttons to an Arduino that will be used as the transmitter
2. Wire the piezo speaker to an Arduino that will be used as the receiver
3. Attach the RF transceivers to each of the Arduinos
Coding
4. Since all students in the class will be transmitting data concurrently, it is important that
each pair of transceivers be programmed on different frequencies to avoid interference.
This can be accomplished by changing the frequency in BOTH, the transmitter and
receivers codes, by just one number. For example:
»»const uint64_t pipe=0xE8E8F0F0E1LL; const uint64_t pipe=0xE8E6F0F0E1LL;
5. Edit the sample code from the previous page so that the transmitter code records the
status of the buttons. For example:
elephant[0] = digitalRead(2);
6. Edit the receiver code so that specific tones are played based on which buttons are
pressed. For example:
if(rocket[0] == LOW)
{
tone(4, 550);
delay(500);
}
else
{
noTone(4);
}
Frequencies for some common Chords include:
C = 262
D = 294
E = 330
F = 349
G = 392
A = 440
B = 494
7. Edit the code so that just pushing a button
once will play the entire song automatically
Add LED's to the project that will light up with the
beat of the song.
CIJE | Appendix D – RF Transmitter 273