Skip to content

Instantly share code, notes, and snippets.

#include <SoftwareSerial.h>
#include <Wire.h>
#define BTTX 2
#define BTRX 3
#define Led 13
byte serialA;
SoftwareSerial I2CBT(BTTX,BTRX);
void CtrlLED(char str[128]);
/*================================================*/
void setup(){
/**********************************************************
Name:String Split
DATE:2016/03/31
By CharlotteHong
**********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* ================================================== */
@hunandy14
hunandy14 / String_Split.ino
Last active March 31, 2016 03:44
Arduino
/**********************************************************
Name:String Split Arduino
DATE:2016/03/31
By CharlotteHong
**********************************************************/
#define led 13
/* 切割字串 (要切割的字串,切割的符號)
字串的格式如 srt[]="1,2";
回傳值為一陣列起始值0為陣列長度 */
int* str_split(const char* str, const char* sp);
@hunandy14
hunandy14 / stringsplit.cpp
Created April 1, 2016 15:00
字串切割
/**********************************************************
Name:String Split
DATE:2016/04/01
By CharlotteHong
**********************************************************/
#include <stdio.h>
#include <iostream>
using namespace std;
/* ================================================== */
/* 切割字串 (要切割的字串,切割的符號)
@hunandy14
hunandy14 / PiUart_arduino.ino
Last active April 8, 2016 03:17
RaspberryPi
#include <SoftwareSerial.h>
#include <Wire.h>
#define UartRX 2
#define UartTX 3
#define Led 13
SoftwareSerial I2CBT(UartRX ,UartTX );
void CtrlLED(char str[128]);
/*================================================*/
void setup(){
/*
Blue_ATCommand
DATA:20150423
Ver3:20150425_12
NAME:Charlotte.HonG
*/
#include <SoftwareSerial.h>
#include "Timer.h"
#define BT_RX 2
#define BT_TX 3
@hunandy14
hunandy14 / str2int.c
Last active April 8, 2016 03:19
字串轉整數
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[]){
char s[] = "tem45";
char t[2];
strncpy(t,s+3,2);
printf("tem=%c%c\n",t[0],t[1]);
int i=0;
#include <SoftwareSerial.h>
#include <Wire.h>
#define Uart_Tx 2
#define Uart_Rx 3
#define Led 13
SoftwareSerial Uart(Uart_Tx,Uart_Rx);
char str[32]="";
/*================================================*/
void setup(){
import serial
import os
os.system("sudo chmod 666 /dev/ttyAMA0")
Uart = serial.Serial("/dev/ttyAMA0", baudrate = 38400, timeout = 1)
Uart.write("Pi UART is already.")
print("Pi UART is already.")
while True:
UartSTR = Uart.readline()
#include <stdio.h>
#include <stdlib.h>
// 宣告節點結構
typedef struct nodestruct{
int data;
struct nodestruct* next;
} node;
// 宣告相關函式