Click here to access the Canvas page with the repository for this studio.

By the end of the exercise, you should know:

Now that you know the basics of the Arduino IDE and its programming language, it’s time to go a bit more in-depth about how it and computers in general work.
If you took CSE 1301 or AP Computer Science, you should already be familiar with Java. We will still use a lot of Java in this class, but we’re also switching the emphasis to another language called C.
We do this for two reasons:
Unlike Java, which runs on a virtual machine on top of your existing operating system, C compiles to pure machine language: the direct instruction set that your computer actually runs. In other words, if you’d like to see the exact instructions your computer uses to draw a pixel onscreen in a video game or download your email, you look at a compiled C program.
Lucky for us, uncompiled C (like, C code) looks a lot like Java. So much so that you should be able to read C with no problems.
Compiled code is a different story. We’ll deal with the human-readable “rendition” of machine-language, Assembly, later in the semester, but for now we’ll deal with the more immediate problem of how programs interact with the computer.

But before we can ever talk about I/O (input/output) and programs and compiling things, you need to understand how the computer stores data. In other words, before you can understand how computers manipulate data, you must know how they represent it.
To that end, we’ve prepared some pen-and-paper exercises to get you thinking about data like a computer does.
If you are having trouble with the concepts behind any of these questions, try reading Chapter 8 in the course textbook or look through the Guide to Information Representation.
Binary is what every form of data on your computer eventually boils down to: some chain of HIGHs and LOWs, zeroes and ones. These questions will explore your understanding of binary as a base 2 number system.
The subscript on a number indicates its current base. If no base is given, assume base 10.
Hexadecimal is base 16. It ends up being a very nice way of representing computer-related numbers because it jives with binary so well.
A through F to go up to base 16. What is the highest base we can represent if we use all the letters of the alphabet?If possible, have a TA check your answers before moving on

Both the Arduino IDE and your Eclipse Workspace should be set up before starting this section (see Studio 0 for help).
bits.ino ( bits / bits.ino)Run bits.ino in the Arduino IDE, opening up the Serial Monitor after it is done uploading.
In the Serial Monitor you will see the number 100 written in Decimal, Hexadecimal, and Binary. You will also see what the number looks like after a LEFT-SHIFT, RIGHT-SHIFT, and INVERSE.
LEFT-SHIFT do?RIGHT-SHIFT do?INVERSE do?avoid setup() {
unsigned a = 100; //Change this number
...
a greater than 32768
LEFT-SHIFT?
Here is a great introduction to FSMs. They are also described in Chapter 7 of the text (read Section 7.1).
For the final part of the studio we have designed another program FSMs.ino, a simplified binary counter, designed to introduce you to the concepts and syntax of FSMs that you will need for Assignment 1
FSMs.ino ( FSMs / FSMs.ino)FSMs.ino onto the ArduinoHere is a visual depiction of the FSM:

1 : 001.Here is this FSM’s enum:
enum State {
up0, // 0
up1, // 1
up2, // 2
up3, // 3
up4, // 4
up5, // 5
up6, // 6
up7, // 7
};
State counterState = up0;
What does this Output:
state = up4;
Serial.print(state);
Enum types in C are just numbers with readable names, and those names are not compiled into your program – meaning “up4” is not accessible at runtime. In other Languages, however, Enums sometimes have a toString() or name() method that will allow access to a name at runtime.
An Enum is useful when a variable can only take one out of a small set of possible values. Examples include Months, Game Pieces, or the Cardinal Directions.
A great way to think about these are Drop Down Selection boxes:
](selectBox.png)
There can only be one selection from Multiple Choices
enum Fruit {
Banana,
Apple,
Mango
};
Fruit myFruit = Banana;
switch(myFruit) {
case Banana:
print("Banana Selected");
break;
case Apple:
print("Apple Selected");
break;
case Mango:
print("Mango Selected");
break;
}
switch statements are where enums shine.
Here is the Switch statement from the Example:
switch(state){
case up0: //When state up0 , the FSM must:
bit1 = 0; //set the bits to match the Count
bit2 = 0;
bit3 = 0;
pprint(state);
state = up1; //Move to the next state
//The next loop will go to case up1
break; //Break to the end of the switch
//So the next case won't run too
case up1: //only if counterState == up1
}
Here is an example of an FSM that can both switch and remain in its own state depending on the Input:

Things can get Confusing Quickly:

Go through Key Concepts in your head to make sure you have all that you need to start on Assignment 1. As always if you think you missed a concept or just want a wonderful TA to explain it to you Please Ask (it’s their job). In addition, there will be a lecture on Thursday that will go over a large fraction of this material.

Make sure to commit your workspace
In Eclipse's package explorer, any files you have modified since your last commit are prefixed with a >.
If you have saved some files from the Arduino IDE, they might not yet appear in the navigation pane of Eclipse. Right-click on your repo and choose Refresh and they should show up.
Right-click the outer-most folder (you want to commit everything within), and choose Team>Commit.... Write a helpful message and press Commit and Push.
You can verify that your changes went to the server by going to your GitHub page for your repository. Click the “Source” link on the left side of the page and make sure your file exists with the code that you wrote.
Check out with a TA
Repository structure for this studio:
studio01/
bits/
bits.inoFSMs/
FSMs.ino
This is a checklist for you to see what the Studio is designed to teach you.
switch
break
Generated at 2026-08-27 17:25:43 +0000.
Page written by Claire Heuckeroth, Ben Stolovitz, Sean Schaffer, and Roger Chamberlain.