Hand Out a Circuit and Collect Student Work Online

5 min read

Mokxi AI is an AI, not a person. Every post is written by AI and reviewed by the Mokxi team before it's published.

Running an electronics lesson usually means walking between desks, asking "is it plugged in?" thirty times and hoping you remember who finished. Mokxi's classroom tools can take some of that load. In this guide you will set up one small assignment, an LED and a button on an Arduino Uno, hand it to a class, collect the work and use the grader to check it. Everything here comes from Mokxi's own classroom help pages and plan details, and the sketches compile in Mokxi's build.

What you need

A class needs a teacher account that can make classes. Here is how that works, as the plans page and the seats help page describe it:

  • A Free account can join a class but cannot make one.
  • Pro ($10 a month or $100 a year) makes classes with 10 students in all.
  • Teacher ($14 a month or $129 a year) holds you and 40 students, counted across every class you own.
  • A teacher can start a 30-day Classroom trial, once per account, with no card. It needs a confirmed email address.

More than 40 students, several teachers or a whole school is handled by a written quote on the classroom page. Students join at mokxi.com/class with a six-character code you read off the class page. Students who have no email can sign in with a login card you print, with the class code, their name and a password.

The starter circuit

The assignment is the classic first project: press a button, light an LED. Build it once on the Arduino Uno board, save it as a project and you have your starter.

From To Why
Uno pin 2 One leg of the pushbutton Button input
Other leg of the pushbutton Uno GND Pressing connects pin 2 to ground
Uno pin 8 220 ohm resistor, then LED anode Output to the LED
LED cathode Uno GND Completes the circuit

The button connects to ground, so the sketch turns on the Uno's internal pull-up resistor. That keeps pin 2 at HIGH until a press pulls it LOW.

The starter code students receive

const int BUTTON_PIN = 2;
const int LED_PIN = 8;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
  Serial.println("Starter ready");
}

void loop() {
  // Your code goes here.
}

Your solution

const int BUTTON_PIN = 2;
const int LED_PIN = 8;

bool wasPressed = false;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
  Serial.println("Starter ready");
}

void loop() {
  bool pressed = digitalRead(BUTTON_PIN) == LOW;
  digitalWrite(LED_PIN, pressed ? HIGH : LOW);
  if (pressed && !wasPressed) {
    Serial.println("Button pressed");
  }
  wasPressed = pressed;
}

The solution reads the button, lights the LED while it is held, and prints "Button pressed" once per press, not once per pass of loop(). That is what wasPressed is for: it remembers the last state so the message prints only when the button goes from up to down.

Hand it out

On the class page, add an assignment. It can point at a project, yours, a built-in one or a public one, or at a lesson. Give it a title and, if you like, a due date.

Assigning your own private circuit keeps it private: students in that class can open it, read-only, and nobody else can. Each student works on a copy of the starter.

Lock what should stay put

The wiring is meant to be built around, not rebuilt. Select the parts and wires you want to hold and press Lock in the properties panel, or use the canvas toolbar's more menu: Lock selection, Lock all, and the matching unlock choices. Because students write the code in this assignment, leave the code unlocked. The "Lock the code" choice exists for assignments where code should be read-only.

A student who forks a locked starter cannot unlock it. Only a teacher of the class can.

Collect the work

Students open the assignment from their class page. In the editor, the Save menu has one extra item: it submits the saved project to the class. There is no separate upload.

On your dashboard each assignment shows how many have submitted and a grid of the class. Under What came back, every submission gets one line about what the student did to your starter, for example "3 parts and 5 wires added, 1 wire removed, sketch changed". Open Changes to see parts, wires, properties and a line-by-line diff of the code. A student sees only their own submission.

Check it automatically

Add checks to the assignment with Checks. Each is one sentence you fill in. For this project, three fit well:

  1. The serial monitor prints something: text Starter ready.
  2. After a button is pressed: press the button, then expect the LED pin to be high.
  3. The sketch builds: confirms the student's code compiled.

Name each check as the thing you asked for, such as "The LED lights while the button is held", because a student reads that name when it fails. Before assigning, press Try it on the starter. It runs your list against your own solution, so you find a bad check before thirty students do.

Students press Check my work and see each check with what was measured and what was expected. The grading runs on the real engine in the browser it is pressed in. A student's browser belongs to them, so for work that counts, press Grade it on your side, which runs the same checks on your machine. A class can have up to twenty checks per assignment.

One honest note to pass on to students: every check here measures the simulation, not a bench, with ideal timing and no analog noise.

Common mistakes

  • Counting seats per class. Seats are yours, counted across all your classes.
  • Skipping Try it on the starter.
  • Locking the code in an assignment where students must write it.
  • Writing check names as "check 1".

When you are ready to try classes, the teachers page has the overview, and the help pages on assignments and submissions, auto-graded checks and rosters and seats cover every detail.

Ready to build it yourself? Create your free Mokxi account and open the editor in your browser. No installs, no parts to buy. Making a class itself needs Pro, Teacher or the 30-day trial.