Skip to content

Instantly share code, notes, and snippets.

View yuma-m's full-sized avatar

Yuma Mihira yuma-m

View GitHub Profile
// SRF02のアドレスを変更
#include <Wire.h>
byte original_address = 224; // 変更前のアドレス: 0xE0
byte new_address = 226; // 変更後のアドレス: 0xE2
void setup() {
Wire.begin();
Serial.begin(9600);
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import RPi.GPIO as GPIO
import time
import milkcocoa.milkcocoa as milkcocoa
@yuma-m
yuma-m / subscribe_custom_point_cloud.py
Created February 26, 2016 06:15
ROS Customized PointCloud2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from sensor_msgs.msg import PointCloud2
import sensor_msgs.point_cloud2 as pc2
class SubscribePointCloud(object):
def __init__(self):
@yuma-m
yuma-m / publish_custom_point_cloud.py
Last active July 29, 2021 02:41
ROS Customized PointCloud2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import Header
from sensor_msgs.msg import PointCloud2, PointField
import sensor_msgs.point_cloud2 as pc2
# 点の座標を定義するフレームの名前
HEADER = Header(frame_id='/sample_frame')
@yuma-m
yuma-m / sync_sensor_led.py
Last active February 16, 2016 15:07
Synchronize sensor input and LED output
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# Synchronize sensor and LED
from __future__ import print_function
import RPi.GPIO as GPIO
import os
import time
@yuma-m
yuma-m / raspi_push_switch_to_play_music.py
Created February 14, 2016 10:09
Play song when switch connected to GPIO is pushed
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import RPi.GPIO as GPIO
import os
import time
import random
import shlex
@yuma-m
yuma-m / raspi_gpio_pin.py
Created February 14, 2016 09:03
Print Raspberry Pi GPIO Pin Status
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import RPi.GPIO as GPIO
import time
# Pin Number
PIN = 19