This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os, time | |
from OmegaExpansion import oledExp | |
from OmegaExpansion import relayExp | |
import subprocess | |
import json | |
#initializing the Relay and Oled Expansions, and block the lock if it's open | |
def initial_setup(): | |
#initializing the Relay and Oled Expansions | |
status_oled = oledExp.driverInit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Omega Dial</title> | |
<script src="jquery.min.js"></script> | |
<!--[if IE]><script type="text/javascript" src="excanvas.js"></script> | |
<script src="jquery.knob.min.js"></script> | |
</head> | |
<style> | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, getopt, json | |
import paho.mqtt.client as mqtt | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import SocketServer | |
position = 0 | |
class PotentiometerHTTPHandler(SimpleHTTPRequestHandler): | |
def __init__(self, request, client_address, server): | |
SimpleHTTPRequestHandler.__init__(self, request, client_address, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// analog pin for reading the potentiometer value | |
int potPin = A0; | |
// resistance value | |
int potValue = 0; | |
// delay between sensor reads for stability | |
int readDelay = 100; | |
// code to be run once at the start of the program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, getopt | |
import paho.mqtt.client as mqtt | |
from motors import Servo | |
# Main program to obtain the servo angle and publish to MQTT | |
def __main__(): | |
#Setup MQTT and Instantiate the Servo Motor | |
mqttc = mqtt.Client() | |
servoMotor = Servo(0, 500, 2500) | |
## Define the MQTT Callbacks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from OmegaExpansion import pwmExp | |
class OmegaPwm: | |
"""Base class for PWM signal""" | |
def __init__(self, channel, frequency=50): | |
self.channel = channel | |
self.frequency = frequency | |
# check that pwm-exp has been initialized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// analog pin for reading the potentiometer value | |
int potPin = A0; | |
// angle of the servo to be send to Omega | |
int angle = 0; | |
// delay between sensor reads for stability | |
int readDelay = 100; | |
// code to be run once at the start of the program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from OmegaExpansion import onionI2C | |
#initializing I2C communication | |
i2c = onionI2C.OnionI2C(0) | |
#initializing Slave's device address and a degree sign for printing | |
devAddres = 0x08 | |
degree = unichr(176) | |
#reading and storing the value of the 0x00 register |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the scale factor of TMP36 (temperature sensor) is 10 mV/°C with a 500 mV offset to allow for negative temperatures | |
#include <Wire.h> | |
// the analog pin number connected to the TMP36 | |
#define slaveAddr 0x08 | |
// defining global flags as actual registers | |
#define RD_REG_TEMP_INT_CEL 0x00 | |
#define RD_REG_TEMP_FRA_CEL 0x01 | |
#define RD_REG_TEMP_INT_FAR 0x02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the scale factor of TMP36 (temperature sensor) is 10 mV/°C with a 500 mV offset to allow for negative temperatures | |
// the analog pin number connected to the TMP36 | |
int sensorPin = A0; | |
void setup() | |
{ | |
//initializing serial communication with the Omega2 for sending sensor data | |
Serial.begin(9600); | |
} |
NewerOlder