This file contains hidden or 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
// gist.github.com/doojinkang gyro.ino | |
#include "MPU6050.h" | |
MPU6050 accelgyro; | |
int16_t ax, ay, az; | |
int16_t gx, gy, gz; | |
#define GYRO_FACTOR 131.0 * M_PI / 180 |
This file contains hidden or 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 processing.serial.*; | |
import processing.opengl.*; | |
import toxi.geom.*; | |
import toxi.processing.*; | |
import java.nio.*; | |
ToxiclibsSupport gfx; | |
Serial port; // The serial port | |
char[] teapotPacket = new char[100]; // roll, pitch, yaw csv string from port |
This file contains hidden or 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
// gist.github.com/doojinkang mpu6050.ino | |
#include "MPU6050.h" | |
uint8_t devAddr = 0x68; | |
// store calibration | |
float gyro_x_base = 0; | |
float gyro_y_base = 0; | |
float gyro_z_base = 0; |
This file contains hidden or 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
public static Class[] getClasses(String packageName) | |
throws ClassNotFoundException, IOException { | |
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); | |
assert classLoader != null; | |
String path = packageName.replace('.', '/'); | |
Enumeration resources = classLoader.getResources(path); | |
List<File> dirs = new ArrayList<File>(); | |
while (resources.hasMoreElements()) { | |
URL resource = (URL) resources.nextElement(); | |
dirs.add(new File(resource.getFile())); |
This file contains hidden or 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
package dcmotor.lge.com.dcmotor; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.view.Menu; | |
import android.view.MenuItem; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.EditText; | |
import android.widget.TextView; |
This file contains hidden or 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
int motorPin1 = 5; | |
int motorPin2 = 9; | |
void setup() | |
{ | |
pinMode(motorPin1, OUTPUT); | |
pinMode(motorPin2, OUTPUT); | |
Serial.begin(115200); | |
} |
This file contains hidden or 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 signal import signal, SIGINT | |
from sys import exit | |
from enum import Enum | |
import serial | |
PORT_NAME = '/dev/tty.usbserial-00001014' | |
''' | |
quality is not used | |
sensor data = distance / 10 |
This file contains hidden or 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
// #define HC_05 | |
#ifdef HC_05 | |
// Arduino + HC_05 altserial | |
#define SERIAL_BAUD 19200 | |
#include "AltSoftSerial.h" | |
AltSoftSerial altSerial; | |
#define MySerial altSerial | |
#else | |
// BLE NANO |
This file contains hidden or 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
var noble = require('@abandonware/noble'); | |
var deviceInfoUUID = '180a'; | |
var bleServiceUUID = process.argv[2].toLowerCase(); // 'dfb0' or 'ffe0'; | |
var serialPortCharacteristicUUID = process.argv[3].toLowerCase(); // 'dfb1', or 'ffe1'; | |
var serialPortCharacteristic = null; | |
var found = false; | |
noble.on('stateChange', function(state) { |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
int buffer[100]; | |
int test_buffer(int upper) { | |
for ( int i = 1; i <= upper; i++) { | |
for ( int j = i+1; j <= upper; j++) { | |
if ( buffer[i] == buffer[j]) | |
return 0; |
NewerOlder