Skip to content

Instantly share code, notes, and snippets.

View monpetit's full-sized avatar
💭
I may be slow to respond.

YoungSik Won monpetit

💭
I may be slow to respond.
View GitHub Profile
int enablePin = 11;
int in1Pin = 10;
int in2Pin = 9;
boolean dir = false;
int speed = 255;
void setup()
{
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
#define ARRAY_SIZE 30
#define MEASURE_INVERVAL_MS 100
#define REPORT_INVERVAL_MS 5000
const int measurePin = A0;
const int ledPower = 3;
const int samplingTime = 280;
const int led = 13;
uint32_t count = 0;
// Timer1 output compare A interrupt service routine
ISR(TIMER1_COMPA_vect)
{
// Place your code here
Serial.print("systick = ");
Serial.println(millis());
void setup_timer1(void)
{
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 62.500 kHz
// Mode: CTC top=OCR1A
// OC1A output: Disconnected
// OC1B output: Disconnected
// Noise Canceler: Off
// Input Capture on Falling Edge
const int measurePin = A0;
const int ledPower = 3;
const int samplingTime = 280;
const int deltaTime = 40;
const int sleepTime = 9680;
float voMeasured = 0;
void adc10_measure_dust_density(void)
{
digitalWrite(ledPower, LOW); // LED 켜기
void reset_blink_rgb(void)
{
volatile u08 countdown = 30;
while (countdown--) {
show_rgb(0, 255, 0);
show_rgb(255, 0, 0);
__delay_ms(15);
show_rgb(0, 0, 0);
show_rgb(0, 0, 0);
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t u08;
#define RAND8() (rand() % 256)
#define RGB_LED_PORT (gpioPortE)
#define RGB_LED_PIN (11)
#define LED_HI() GPIO_PinOutSet(RGB_LED_PORT, RGB_LED_PIN)
#define LED_LO() GPIO_PinOutClear(RGB_LED_PORT, RGB_LED_PIN)
void ssd1306_data(uint8_t c)
{
if (use_i2c) {
static uint8_t control = 0x40;
I2C_TransferSeq_TypeDef seq;
seq.addr = (0x3C << 1);
seq.flags = I2C_FLAG_WRITE_WRITE;
seq.buf[0].data = &control;
seq.buf[0].len = 1;
void ssd1306_command(uint8_t c)
{
if (use_i2c) {
static uint8_t control = 0x00;
I2C_TransferSeq_TypeDef seq;
seq.addr = (0x3C << 1);
seq.flags = I2C_FLAG_WRITE_WRITE;
seq.buf[0].data = &control;
seq.buf[0].len = 1;
/**************************************************************************//**
* @file
* @brief Empty Project
* @author Energy Micro AS
* @version 3.20.2
******************************************************************************
* @section License
* <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
*******************************************************************************
*