Things used in this project

Hardware components:
Thebase 97044185 8470 483f 8e2d 764c8d13dad0 grande
Modulo Base
×1
Thecontroller e8d08231 4c27 40d1 a660 46968bc162aa grande
Modulo Controller
×1
Theknob b7c2a1a3 69ea 4ce2 b565 7909a31f1f81 grande
Modulo Knob (for Modulo)
×1
Micro Servo Motor HD-1800A
×1
Heavy Printer Paper
×1
Clear Tape
×1
Software apps and online services:
Ide web
Arduino IDE
Hand tools and fabrication machines:
Scissors or Craft Knife

Schematics

Zoltar.ai
Zoltar.ai
ZoltarAccessories.pdf
ZoltarAccessories.ai
ZoltarAccessories.ai
Zoltar.pdf

Code

Zoltar.inoArduino
Run this sketch with the Arduino app.
#include "Modulo.h"
#include "Wire.h"
#include "Servo.h"

KnobModulo knob;
Servo servo;

int currentPos = 0;
int servoAngle = 0;
void onPositionChanged(KnobModulo &k) {
    servoAngle -= 18*(knob.getPosition()-currentPos);
    currentPos = knob.getPosition();

    if (servoAngle < 0) {
        servoAngle = 0;
    }
    if (servoAngle > 180) {
        servoAngle = 180;
    }

    knob.setHSV(servoAngle/180.0, 1, 1);
    Serial.println(servoAngle);
    servo.write(servoAngle);
}

void onButtonPress(KnobModulo &k) {
    // First get the current time in milliseconds.
    long startTime = millis();

    // Continually do this until 3 seconds (3000ms) past the start time
    while (millis() < startTime + 3000) {
        // Figure out the servo angle, which ranges between 0 and 180
        // in a sinusoidal pattern based on the current time.
        servo.write(90*(1 + sin(millis()/400.0)));

        // Set the hue of the knob based on the current time too.
        knob.setHSV((millis() % 500)/500.0, 1, 1);
    }
}


void setup() {
    servo.attach(0);
    knob.setPositionChangeCallback(onPositionChanged);
    knob.setButtonPressCallback(onButtonPress);
}

void loop() {
    Modulo.loop();

    knob.setHSV(0, 1, sin(millis()/1000.0));
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

How to  Control Single Servo Motor by Joystick
Easy
  • 55
  • 0

Mabuhay! Darwin here. In this project, I will teach you how to control a servo motor using a joystick module.

Personal Thermostat
Easy
  • 1,249
  • 14

Senses and displays temperature and humidity, and controls power to fans, heaters, etc. based on flexible temperature trip points.

Modulo Temperature Probe Example
Easy
  • 335
  • 4

Full instructions

A full-featured thermometer with selectable display, color indicator, high/low recording, and thermal alarms.

Modulo's Internet Connected Sous Vide Machine
Easy
  • 541
  • 6

Full instructions

Make the perfect steak with a sous vide machine made using Modulo, Particle and an old Crock Pot

Automated Coffee Maker
Easy
  • 330
  • 3

A coffee maker that can be controlled and temperature monitored over the cloud using a Particle Photon.

Automated Coffee Maker

Team Coffee Connoisseurs

IoT Code Deployer-er
Easy
  • 150
  • 2

Full instructions

A code deployer-er remote for building and deploying projects, for the IoT fanatic who can't be bothered to sign into a build server.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback