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
#include "mbed.h"
#include "SDFileSystem.h"
#include "EthernetInterface.h"
#include <stdio.h>
#include <string.h>
#define PORT 80
EthernetInterface eth;
const int pin = 8;
void setup()
{
pinMode(pin, OUTPUT);
while (1) {
digitalWrite(8, HIGH);
digitalWrite(8, LOW);
const int pin = 8;
void setup()
{
pinMode(pin, OUTPUT);
volatile uint8_t* port = portOutputRegister(digitalPinToPort(pin));
uint8_t mask = digitalPinToBitMask(pin);
void setup()
{
DDRB |= (1 << 0);
while (1) {
PORTB ^= (1 << 0);
}
}
#include <SoftwareSerial.h>
SoftwareSerial Serial(2, 1); // RX, TX
const int analog_pin = A3;
int value;
void setup()
{
#include <TinyWireS.h>
#define I2C_SLAVE_ADDRESS 0x19 // the 7-bit address
#ifndef TWI_RX_BUFFER_SIZE
#define TWI_RX_BUFFER_SIZE (16)
#endif
#define CMD_LED_ON 0xA0
#define CMD_LED_OFF 0xA1
#include <Wire.h>
#define I2C_SLAVE_ADDRESS 0x19 // the 7-bit address
#define CMD_LED_ON 0xA0
#define CMD_LED_OFF 0xA1
#define CMD_ADD_NUM 0xB0
#define CMD_GET_RESULT 0xB1
void setup()
#include <Wire.h>
#define I2C_SLAVE_ADDRESS 0x4 // the 7-bit address
#define MEASURE_TEMPERATURE 0xA0
#define SEND_TEMPERATURE 0xB0
#define TEMP_CONST 10 // (1 Celcius == 10 mV)
#define TEMP_RESOLUTION 1024 // 2^10 (10 bits)
#define UNIT_CHANGE 1000 // (1V = 1000 mV)
#define I2C_SLAVE_ADDRESS 0x4 // the 7-bit address
// Get this from https://github.com/rambo/TinyWire
#include <TinyWireS.h>
// The default buffer size, though we cannot actually affect it by defining it in the sketch
#ifndef TWI_RX_BUFFER_SIZE
#define TWI_RX_BUFFER_SIZE (16)
#endif
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_apps_rcm.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin.h"
#include "driverlib/gpio.h"
#include "driverlib/prcm.h"