This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// give it a name: | |
int _led = D7; | |
//function definition | |
int led(String command); | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize the digital pin as an output. | |
pinMode(_led, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
spark "github.com/julianshen/SparkGo" | |
"time" | |
) | |
func main() { | |
core := spark.SparkCore{"YOUR_ACCESS_TOKEN","DEVICE_ID"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SparkCore = require('./spark_core'); | |
var util = require('util'); | |
var juliansCore = new SparkCore({ | |
device_id: 'YOUR_DEVICE_ID', | |
access_token: 'YOUR_ACCESS_TOKEN' | |
}); | |
var val = 0; | |
(function blink() { | |
val = (val + 1) % 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Blink | |
Turns on an LED on for one second, then off for one second, repeatedly. | |
This example code is in the public domain. | |
*/ | |
// give it a name: | |
int led = D7; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public LayoutParams generateLayoutParams(AttributeSet attrs) { | |
return new CellLayoutParams(getContext(), attrs); | |
} | |
public static class CellLayoutParams extends MarginLayoutParams { | |
public int cellX = 0; | |
public int cellY = 0; | |
public int cellRowSpan = 1; | |
public int cellColSpan = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SimpleCellLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
initFromAttributes(context, attrs); | |
} | |
public SimpleCellLayout(Context context, AttributeSet attrs, int defStyle) { | |
super(context, attrs, defStyle); | |
initFromAttributes(context, attrs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<declare-styleable name="SimpleCellLayout"> | |
<attr name="col" format="integer"/> | |
<attr name="row" format="integer"/> | |
<attr name="gapsize" format="dimension"/> | |
<attr name="colspan" format="integer"/> | |
<attr name="rowspan" format="integer"/> | |
<attr name="cellX" format="integer"/> | |
<attr name="cellY" format="integer"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:celllayout="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<com.jlnshen.widget.celllayout.SimpleCellLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:id="@+id/textClock" | |
android:textSize="60sp" | |
android:textColor="#b3b5b5" | |
android:format24Hour="k"/> | |
<blink android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextClock | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:id="@+id/textClock" | |
android:textSize="60sp" | |
android:textColor="#b3b5b5" | |
android:format24Hour="k"/> | |
<blink android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> |