Skip to content

Instantly share code, notes, and snippets.

@ultramcu
ultramcu / calculator.cpp
Created November 26, 2015 13:34
Exposing Attributes of C++ Types to QML
#include "calculator.h"
calculator::calculator()
{
this->num = 0;
}
qint32 calculator::get_number()
{
@ultramcu
ultramcu / GoodWriting_1_1.c
Created May 10, 2015 06:56
Arduino Learing Why we use #define
//GoodWriting 1.1 Preprocessive director -> #define
#include <stdint.h>
///* <----- 1
//740,9
#define LED_1 7
#define LED_2 6
#define LED_3 5
#define LED_4 4
//*/
@ultramcu
ultramcu / SimpleSerialStateMachine.c
Created May 7, 2015 12:24
Simple State Machine to receive message via Serial Port for Arduino
/*
Simple State Machine to receive message via Serial Port for Arduino
=======
WEBSITE
=======
https://www.facebook.com/appstack.cc
http://www.appstack.cc
<------------------------------------------------------------------->
@Author
- ultra_mcu@Piak Studiolo LEGO eiei
@ultramcu
ultramcu / app_stack_uart.c
Last active February 17, 2024 22:53
C Library for Raspberry Pi Send/Receive Serial
/*************************
* UART For Raspberry Pi (2014/10/10)
* gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
*
* copyright ultra_mcu@msn.com
* www.appstack.in.th
* https://github.com/ultramcu/AppStackUART
* ***********************/
#include <stdio.h>
@ultramcu
ultramcu / sshfs_auto_mount.bat
Created October 20, 2014 11:17
sshft auto mount
#!/bin/bash
remote_user=USER_NAME
remote_target=SERVER_IP
remote_path=SERVER_PATH
source_path=LOCAL_PATH
mount_name=MOUNT_NAME
@ultramcu
ultramcu / step_motor_drvie_thb7182
Created June 16, 2014 14:17
Step Motor Drive with THB7128
#include <Makeblock.h>
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <AccelStepper.h>
#define _PIN_CLK_ 13
#define _PIN_CW_ 12
#define _DIP_SW_EXCITATION_ 16
#include "stdint.h"
typedef union {
struct{
uint8_t bit_0: 1;
uint8_t bit_1: 1;
uint8_t bit_2: 1;
uint8_t bit_3: 1;
uint8_t bit_4: 1;
@ultramcu
ultramcu / st_union.c
Created May 26, 2014 17:02
Access bit by union
typedef union {
struct {
uint8_t bit_0: 1;
uint8_t bit_1: 1;
uint8_t bit_2: 1;
uint8_t bit_3: 1;
uint8_t bit_4: 1;
uint8_t bit_5: 1;
uint8_t bit_6: 1;
uint8_t bit_7: 1;
@ultramcu
ultramcu / arduino_code3.c
Created May 10, 2014 18:19
Arduino Pass by reference
typedef struct
{
int data;
}st_struct;
void my_fn(void *st)
{
st_struct *s = (st_struct *)st;
@ultramcu
ultramcu / arduino_code.c
Created May 10, 2014 17:56
Arduino pass by reference
typedef struct
{
int data;
}st_struct;
void my_fn(st_struct *st)
{
...