Skip to content

Instantly share code, notes, and snippets.

@andriyadi
andriyadi / HelloOLED.cpp
Created July 14, 2020 22:13
MXChip IoT DevKit hello world
#include <Arduino.h>
#include <OledDisplay.h>
unsigned char BMP[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,192,192,224,240,56,12,192,240,224,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,224,224,224,224,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,224,248,252,254,255,255,63,15,3,64,248,254,255,255,255,255,255,252,248,224,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,240,252,1
@andriyadi
andriyadi / HAR-Maix-Infer.py
Last active November 16, 2019 12:44
Managed to create Human Activity Recognition (HAR) model using Keras, and successfully converted to kmodel for K210 MCU. However.... The inference is still off, why oh why?
import image
import KPU as kpu
import lcd
lcd.clear()
lcd.draw_string(100,112,"Loading model...")
print('Loading model...')
task = kpu.load('/sd/HAR.kmodel')
{
"framework-maixduino":[
{
"sha1": "c9f46c0bd7d8233eeea5a2e8d721ac2463b1dc44",
"system": "*",
"url": "https://bigbits.oss-cn-qingdao.aliyuncs.com/Platform-kendryte210/dl-packages/framework-maixduino-0.3.7.tar.gz",
"version": "0.3.7"
}
],
"framework-kendryte210-standalone-sdk":[
{
"packages": [
{
"name": "Maixduino",
"maintainer": "Sipeed",
"websiteURL": "https://maixduino.sipeed.com",
"email": "[email protected]",
"help": {
"online": "https://maixduino.sipeed.com"
},
#include <Arduino.h>
#include <energyic_UART.h>
#define RX_PIN 19
#define TX_PIN 23
HardwareSerial ATMSerial(1);
ATM90E26_UART eic(&ATMSerial);
void setup() {
@andriyadi
andriyadi / SensorActivity.kt
Last active July 23, 2017 12:58
My first ever Kotlin code for Android Things to access BMP280 sensor and display the data to OLED SSD1306 display
package andriyadi.me.my1stthingslab
import android.app.Activity
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.hardware.Sensor
import android.hardware.SensorEvent
@andriyadi
andriyadi / ArtikCloudSimulatorScenarioSample.json
Created October 9, 2016 18:09
Samsung Artik Cloud - Scenario sample for publishing data using Device Simulator
{
"period": 1000,
"data": {
"fallDetected": false,
"heartRate": 0,
"temp": 0,
"timestamp": 0
},
"sdid": "3c85aeff55b245139ad3f0b9b327a351",
"api": "POST",
@andriyadi
andriyadi / Human.swift
Last active September 3, 2016 06:56
Human class in Swift, just for fun
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
//PlaygroundPage.current.needsIndefiniteExecution = true
enum PhotoError: Error {
case NoURL
case BadImageData
#include "DHT.h"
#include <Bridge.h>
#include <YunClient.h>
#include <MQTTClient.h>
YunClient net;
MQTTClient client;
#define DHTPIN 5 //What digital pin we're connected to
@andriyadi
andriyadi / gist:a1a31c47351f5640dfc3
Last active August 29, 2015 14:07
Azure Camp Training - Mobile Services

##Create Mobile Service Create a new mobile service

azure mobile create -l "East Asia" azurecampzumo andri pass@word1

Where:

  • "East Asia" is location
  • azurecampzumo is the mobile service name. Should be unique across the world. Choose your own, you may use your dog name, or any cute name you can think.
  • andri is SQL Server username. SQL Server as the database backing for this mobile service
  • pass@word1 is SQL Server password.