Skip to content

Instantly share code, notes, and snippets.

@neosarchizo
neosarchizo / serial_plotter_multiple.ino
Created October 4, 2019 04:30
[디바이스마트] 아두이노 시리얼 플로터
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print(1); Serial.print("\t"); // space, tab, comma
Serial.print(2); Serial.print("\t");
Serial.print(3);
Serial.println();
}
@neosarchizo
neosarchizo / rs485_test.ino
Created October 30, 2019 13:03
[디바이스마트] RS485 테스트
#include <SoftwareSerial.h>
#define R 9
#define G 10
#define B 11
SoftwareSerial mySerial(2, 3);
int pState = HIGH;
byte id = 0;
@neosarchizo
neosarchizo / .zshrc
Created January 18, 2020 09:10
avrdude shell script Mac OSX
upload_arduino_hex() {
avrdude -p $1 -c avrisp2 -P usb -e -U flash:w:$2 -v
}
# upload_arduino_hex m328p avrisp_mk2_test.ino.with_bootloader.standard.hex
@neosarchizo
neosarchizo / pm2008_calibration.ino
Created January 20, 2020 06:52
[PM2008] 보정
#include <Wire.h>
#define PM2008_I2C_ADDRESS 0x28
// Control modes
#define PM2008_I2C_CTRL_CLOSE_MEASUREMENT 0x1
#define PM2008_I2C_CTRL_OPEN_SINGLE_MEASUREMENT 0x2
#define PM2008_I2C_CTRL_SET_UP_CONTINUOUSLY_MEASUREMENT 0x3
#define PM2008_I2C_CTRL_SET_UP_TIMING_MEASUREMENT 0x4
#define PM2008_I2C_CTRL_SET_UP_DYNAMIC_MEASUREMENT 0x5
@neosarchizo
neosarchizo / gpio_uart.c
Created February 5, 2020 03:56
nRF52 GPIO UART
#include "sdk_common.h"
#include "gpio_uart.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "nrf.h"
static uint8_t gpio_tx_pin;
void gpio_uart_init(uint8_t tx_pin){
gpio_tx_pin = tx_pin;
@neosarchizo
neosarchizo / cm1106_calibration.ino
Last active May 19, 2021 10:51
[Arduino] CM1106 & CM1107 Calibration
#include <cm1106_i2c.h>
CM1106_I2C cm1106_i2c;
void setup() {
cm1106_i2c.begin();
Serial.begin(9600);
delay(1000);
cm1106_i2c.read_serial_number();
delay(1000);
@neosarchizo
neosarchizo / index.md
Created May 18, 2020 07:30
Set ESP32 Environment

Install esp-idf

git clone -b [TAG] --recursive https://github.com/espressif/esp-idf.git esp-idf-[TAG]

@neosarchizo
neosarchizo / main.cpp
Created June 8, 2021 03:25
C++ Bit fields example
#include <stdio.h>
#include <stdint.h>
typedef union
{
uint8_t command;
struct
{
uint8_t a:1;
uint8_t b:1;
@neosarchizo
neosarchizo / manatoki.user.js
Last active June 2, 2024 13:36
마나토끼
// ==UserScript==
// @name 마나토끼
// @namespace https://neosarchizo.github.io/
// @version 1.0.413
// @description try to take over the world!
// @author neosarchizo
// @match https://manatoki340.net/
// @match https://manatoki340.net/page/update
// @match https://manatoki340.net/bbs/page.php?hid=update&page=*
// @match https://manatoki340.net/comic/*
@neosarchizo
neosarchizo / packet.c
Created March 3, 2022 07:53
[Arduino] PM2008 packet
#include "packet.h"
void PACKET_generate(uint8_t cmd, uint8_t length, uint8_t *data) {
// STX
*data = PACKET_STX;
// LEN
*(data + PACKET_POS_LEN) = length - 2;
// CMD
*(data + 2) = cmd;
// CS : STX ^ LEN ^ CMD ^ D...