Skip to content

Instantly share code, notes, and snippets.

import smbus
from time import sleep
bus = smbus.SMBus(1)
SLAVE_ADDRESS = 0x04
def writeCommand(cmd):
bus.write_byte(SLAVE_ADDRESS, cmd)
print("send: ",cmd)
#include <Wire.h>
int SLAVE_ADDRESS = 0x04;
int cmd = 1;
int val = 0;
void setup() {
Wire.begin(SLAVE_ADDRESS);
Wire.onReceive(receiveAnalogReading);
import smbus
from time import sleep
bus = smbus.SMBus(1)
SLAVE_ADDRESS = 0x04
def writeCommand(num, ang):
bus.write_byte(SLAVE_ADDRESS, num)
print("send number: ", num)
#include <Wire.h>
#include <Servo.h>
int SLAVE_ADDRESS = 0x04;
int cmd = 0;
int servoNumber;
int servoAngle;
Servo myservo[2];
import smbus
from time import sleep
bus = smbus.SMBus(1)
SLAVE_ADDRESS = 0x04
def writeCommand(cmd):
bus.write_byte(SLAVE_ADDRESS, cmd)
print("send: ",cmd)
#include <Wire.h>
int SLAVE_ADDRESS = 0x04;
int cmd = 0;
int val = 0;
void setup() {
Wire.begin(SLAVE_ADDRESS);
Wire.onReceive(receiveAnalogReading);
import smbus
from time import sleep
bus = smbus.SMBus(1)
SLAVE_ADDRESS = 0x04
def writeCommand(cmd):
bus.write_byte(SLAVE_ADDRESS, cmd)
print("send: ",cmd)
#include <Wire.h>
#include <Servo.h>
int SLAVE_ADDRESS = 0x04;
int cmd = 0;
Servo myservo;
void setup() {
Wire.begin(SLAVE_ADDRESS);
import smbus
from time import sleep
bus = smbus.SMBus(1)
SLAVE_ADDRESS = 0x04
def writeCommand(cmd):
reading = bus.write_byte(SLAVE_ADDRESS, cmd)
print("send: ",cmd)