Assignment 7A - Part I : Mural Program Storyboard Two Switches

Total Page:16

File Type:pdf, Size:1020Kb

Assignment 7A - Part I : Mural Program Storyboard Two Switches

Name: Period: Date: E-Textiles 1A Assignment 7A –- Part I: Mural Program Storyboard – two switches

Objectives: In this activity you will: ● Use a switch as input ● Program their own computational circuit using conditionals ● Write functions to organize and reuse code.

To turn in your completed answer document: 1. Named your document #-ECS-Asign7A-Part I– MuralProgramStoryboard-Last,First where # is your period. 2. Upload your file to Mr. Gonzalez Textiles’ DropItTo.me (https://dropitto.me/MrGonzalezTextiles )

3. Use the password etextiles

Mural Program Storyboard: Let’s write the program for the Circuit Playground on your mural piece. 1. NAMING SECTION: Declare the variables for your components. Use descriptive names so you know what is what when you are writing the rest of your program:

a. for the 4- led lights, which in this case can be name: your led1, led2, led3 & led4. b. for the switches, switch # 4, switch # 19 and/or switch # 21, in your Circuit Playground can be named switch1, switch2 and/or switch3 /*Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal 20K-ohm resistor is pulled to 5V. This configuration causes the input to read HIGH when the switch is open, and LOW when it is closed.

In other words, when the switch is 'on' (closed/connected), it will read as LOW. If the switch is 'off' (open/disconnected), it will read as HIGH.

*/

/* NAMING SECTION # 1: We name things (lights and switches) to keep track of them easily. What will you name your other lights? */ int ON = HIGH; //This is to make coding for the switch "on" or "off" easier int = ; // These are the names of your lights, and the number of the pin you will connect to. int = ; // We named each led to make it easier to code int = ; int = ;

int = ; //These are the names and numbers of the switches you are using int = ; 2. SETUP SECTION: In the setup() function, initialize your LED’s and Switches you declared in the naming section..

Since lights are output, and Switches are input,

/*SETUP SECTION #2: Put things here that you only need to do once: For instance, OUTPUTS AND INPUTS (lights, switches, . . . ). void setup()  // start serial connection This is for the Circuit { Playground to work properly. Serial.begin(9600); // Here we tell the Circuit Playground to read the switches as INPUT pinMode( , ); pinMode( , ); // Here we tell the Circuit Playground to read the lights as OUTPUT pinMode( , ); pinMode( , ); pinMode( , ); pinMode( , ); } 3. Describe your 4 light patterns (in words, what are they going to look like?):

Pattern # 1: (Describe in words your pattern, what is it going to do or look like)

Pattern # 2: (Describe in words your pattern, what is it going to do or look like)

Pattern # 3: (Describe in words your pattern, what is it going to do or look like)

Pattern # 4: (Describe in words your pattern, what is it going to do or look like) BUILDING BLOCKS SECTION: 4. Write the functions (the code pattern) for your different light patterns from #3, one in each box:

Pattern # 1: (The code that you will be using for this pattern)

Void () // here we need to give a name { to the functions. For example: BlinkingPattern1, } or even heart bit, . . . Remember: LOW is OFF, HIGH is ON delay (1000) is to wait 1 second

Pattern # 2: (The code that you will be using for this pattern)

Void () // here we need to give a name { to the functions. For example: BlinkingPattern1, } or even heart bit, . . . Remember: LOW is OFF, HIGH is ON delay (1000) is to wait 1 second Pattern # 3: (The code that you will be using for this pattern)

Void () // here we need to give a name { to the functions. For example: BlinkingPattern1, } or even heart bit, . . . Remember: LOW is OFF, HIGH is ON delay (1000) is to wait 1 second

Pattern # 4: (The code that you will be using for this pattern)

Void () // here we need to give a name { to the functions. For example: BlinkingPattern1, } or even heart bit, . . . Remember: LOW is OFF, HIGH is ON delay (1000) is to wait 1 second 5. Using the different possible combinations of the two switches. Describe which pattern will run based on the positions of the switches:

Position of the two switches # 1:

Which pattern will you use here: (just mention the name of pattern you will use here)

Position of the two switches # 2:

Which pattern will you use here: (just mention the name of pattern you will use here)

Position of the two switches # 3:

Which pattern will you use here: (just mention the name of pattern you will use here)

Position of the two switches # 4:

Which pattern will you use here: (just mention the name of pattern you will use here)

Recommended publications