SlideShare a Scribd company logo
1 of 28
Download to read offline
Arduino programming of ML-
style in ATS
Arduino programming of ML-
style in ATS
Arduino programming of ML-
style in ATS
Arduino programming of ML-
style in ATS
Arduino programming of ML-
style in ATS
Kiwamu Okabe @ METASEPI
DESIGN / Hongwei Xi @ Boston
University
Kiwamu Okabe @ METASEPI
DESIGN / Hongwei Xi @ Boston
University
Kiwamu Okabe @ METASEPI
DESIGN / Hongwei Xi @ Boston
University
Kiwamu Okabe @ METASEPI
DESIGN / Hongwei Xi @ Boston
University
Kiwamu Okabe @ METASEPI
DESIGN / Hongwei Xi @ Boston
University
Demo: VideoDemo: VideoDemo: VideoDemo: VideoDemo: Video
☆ LCD greeting☆ LCD greeting☆ LCD greeting☆ LCD greeting☆ LCD greeting
☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc
☆ LED fadein☆ LED fadein☆ LED fadein☆ LED fadein☆ LED fadein
☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k
Demo: Software ArchitectureDemo: Software ArchitectureDemo: Software ArchitectureDemo: Software ArchitectureDemo: Software Architecture
Arduino Uno hardwareArduino Uno hardwareArduino Uno hardwareArduino Uno hardwareArduino Uno hardware
It's poor.It's poor.It's poor.It's poor.It's poor.
☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture
☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB
☆ SRAM: 2 KB☆ SRAM: 2 KB☆ SRAM: 2 KB☆ SRAM: 2 KB☆ SRAM: 2 KB
Many people use C language on the
hardware.
Many people use C language on the
hardware.
Many people use C language on the
hardware.
Many people use C language on the
hardware.
Many people use C language on the
hardware.
Problem of C languageProblem of C languageProblem of C languageProblem of C languageProblem of C language
☆ Memory/Resource leak☆ Memory/Resource leak☆ Memory/Resource leak☆ Memory/Resource leak☆ Memory/Resource leak
☆ Out of bounds☆ Out of bounds☆ Out of bounds☆ Out of bounds☆ Out of bounds
☆ Weak type☆ Weak type☆ Weak type☆ Weak type☆ Weak type
We need functional language for
embedded system!
We need functional language for
embedded system!
We need functional language for
embedded system!
We need functional language for
embedded system!
We need functional language for
embedded system!
Approach 1: Virtual machineApproach 1: Virtual machineApproach 1: Virtual machineApproach 1: Virtual machineApproach 1: Virtual machine
Approach 2: DSLApproach 2: DSLApproach 2: DSLApproach 2: DSLApproach 2: DSL
Approach 3: Direct languageApproach 3: Direct languageApproach 3: Direct languageApproach 3: Direct languageApproach 3: Direct language
Comparison of the approachesComparison of the approachesComparison of the approachesComparison of the approachesComparison of the approaches
We choose the 3rd approach.We choose the 3rd approach.We choose the 3rd approach.We choose the 3rd approach.We choose the 3rd approach.
ATS languageATS languageATS languageATS languageATS language
☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/
☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types
☆ Linear types☆ Linear types☆ Linear types☆ Linear types☆ Linear types
☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC
☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free
☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time
Author: Hongwei XiAuthor: Hongwei XiAuthor: Hongwei XiAuthor: Hongwei XiAuthor: Hongwei Xi
ATS programming levelATS programming levelATS programming levelATS programming levelATS programming level
Today, we focus on the level "c",
because Arduino hardware is poor.
Today, we focus on the level "c",
because Arduino hardware is poor.
Today, we focus on the level "c",
because Arduino hardware is poor.
Today, we focus on the level "c",
because Arduino hardware is poor.
Today, we focus on the level "c",
because Arduino hardware is poor.
Functional style programmingFunctional style programmingFunctional style programmingFunctional style programmingFunctional style programming
☆ Functional style programming can be
used with ATS on embedded system?
☆ Functional style programming can be
used with ATS on embedded system?
☆ Functional style programming can be
used with ATS on embedded system?
☆ Functional style programming can be
used with ATS on embedded system?
☆ Functional style programming can be
used with ATS on embedded system?
☆ Yes.☆ Yes.☆ Yes.☆ Yes.☆ Yes.
☆ But only use some of functional style
technique in ATS without GC and
malloc/free.
☆ But only use some of functional style
technique in ATS without GC and
malloc/free.
☆ But only use some of functional style
technique in ATS without GC and
malloc/free.
☆ But only use some of functional style
technique in ATS without GC and
malloc/free.
☆ But only use some of functional style
technique in ATS without GC and
malloc/free.
☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.
Style 1. Envless functionStyle 1. Envless functionStyle 1. Envless functionStyle 1. Envless functionStyle 1. Envless function
☆ Environment-less function.☆ Environment-less function.☆ Environment-less function.☆ Environment-less function.☆ Environment-less function.
☆ Not closure.☆ Not closure.☆ Not closure.☆ Not closure.☆ Not closure.
☆ C language function is also envless
function.
☆ C language function is also envless
function.
☆ C language function is also envless
function.
☆ C language function is also envless
function.
☆ C language function is also envless
function.
%{^ // C language code
int cfunc(int a, int b) {
return (a + b);
}
%}
// ATS language code
extern fun cfunc (a: int, b: int): int = "mac#"
implement main0 () = println! (cfunc (1, 2)) // => 3
%{^ // C language code
int cfunc(int a, int b) {
return (a + b);
}
%}
// ATS language code
extern fun cfunc (a: int, b: int): int = "mac#"
implement main0 () = println! (cfunc (1, 2)) // => 3
%{^ // C language code
int cfunc(int a, int b) {
return (a + b);
}
%}
// ATS language code
extern fun cfunc (a: int, b: int): int = "mac#"
implement main0 () = println! (cfunc (1, 2)) // => 3
%{^ // C language code
int cfunc(int a, int b) {
return (a + b);
}
%}
// ATS language code
extern fun cfunc (a: int, b: int): int = "mac#"
implement main0 () = println! (cfunc (1, 2)) // => 3
%{^ // C language code
int cfunc(int a, int b) {
return (a + b);
}
%}
// ATS language code
extern fun cfunc (a: int, b: int): int = "mac#"
implement main0 () = println! (cfunc (1, 2)) // => 3
Style 2. Stack allocated closureStyle 2. Stack allocated closureStyle 2. Stack allocated closureStyle 2. Stack allocated closureStyle 2. Stack allocated closure
Stack allocated closure is allocated on
stack. It can use free variable.
Stack allocated closure is allocated on
stack. It can use free variable.
Stack allocated closure is allocated on
stack. It can use free variable.
Stack allocated closure is allocated on
stack. It can use free variable.
Stack allocated closure is allocated on
stack. It can use free variable.
fun run (f: &int -<clo1> int): int = f 1
implement main0 () = {
val b = 2
var plus = lam@ (a: int):int => a + b
val () = println! (run plus) // => 3
}
fun run (f: &int -<clo1> int): int = f 1
implement main0 () = {
val b = 2
var plus = lam@ (a: int):int => a + b
val () = println! (run plus) // => 3
}
fun run (f: &int -<clo1> int): int = f 1
implement main0 () = {
val b = 2
var plus = lam@ (a: int):int => a + b
val () = println! (run plus) // => 3
}
fun run (f: &int -<clo1> int): int = f 1
implement main0 () = {
val b = 2
var plus = lam@ (a: int):int => a + b
val () = println! (run plus) // => 3
}
fun run (f: &int -<clo1> int): int = f 1
implement main0 () = {
val b = 2
var plus = lam@ (a: int):int => a + b
val () = println! (run plus) // => 3
}
Style 3. Template functionStyle 3. Template functionStyle 3. Template functionStyle 3. Template functionStyle 3. Template function
The template is functorial style that has
lexical scoping.
The template is functorial style that has
lexical scoping.
The template is functorial style that has
lexical scoping.
The template is functorial style that has
lexical scoping.
The template is functorial style that has
lexical scoping.
extern fun{} base (): int
fun{} plus (a: int): int = a + base ()
implement main0 () = {
implement{} base () = 2
val () = println! (plus 1) // => 3
}
extern fun{} base (): int
fun{} plus (a: int): int = a + base ()
implement main0 () = {
implement{} base () = 2
val () = println! (plus 1) // => 3
}
extern fun{} base (): int
fun{} plus (a: int): int = a + base ()
implement main0 () = {
implement{} base () = 2
val () = println! (plus 1) // => 3
}
extern fun{} base (): int
fun{} plus (a: int): int = a + base ()
implement main0 () = {
implement{} base () = 2
val () = println! (plus 1) // => 3
}
extern fun{} base (): int
fun{} plus (a: int): int = a + base ()
implement main0 () = {
implement{} base () = 2
val () = println! (plus 1) // => 3
}
Safety shaped by ATSSafety shaped by ATSSafety shaped by ATSSafety shaped by ATSSafety shaped by ATS
☆ ATS is a better C language.☆ ATS is a better C language.☆ ATS is a better C language.☆ ATS is a better C language.☆ ATS is a better C language.
☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".
☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.
Safety 1. Termination metricsSafety 1. Termination metricsSafety 1. Termination metricsSafety 1. Termination metricsSafety 1. Termination metrics
".<255 - n>." is termination metric that
grows smaller on each recursive call,
for termination-checking.
".<255 - n>." is termination metric that
grows smaller on each recursive call,
for termination-checking.
".<255 - n>." is termination metric that
grows smaller on each recursive call,
for termination-checking.
".<255 - n>." is termination metric that
grows smaller on each recursive call,
for termination-checking.
".<255 - n>." is termination metric that
grows smaller on each recursive call,
for termination-checking.
fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = {
val () = analogWrite (LED, i)
val () = delay_ms (BLINK_DELAY_MS)
val () = if i < 255 then loop_fadein (i + 1)
}
...
val () = loop_fadein 0
fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = {
val () = analogWrite (LED, i)
val () = delay_ms (BLINK_DELAY_MS)
val () = if i < 255 then loop_fadein (i + 1)
}
...
val () = loop_fadein 0
fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = {
val () = analogWrite (LED, i)
val () = delay_ms (BLINK_DELAY_MS)
val () = if i < 255 then loop_fadein (i + 1)
}
...
val () = loop_fadein 0
fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = {
val () = analogWrite (LED, i)
val () = delay_ms (BLINK_DELAY_MS)
val () = if i < 255 then loop_fadein (i + 1)
}
...
val () = loop_fadein 0
fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = {
val () = analogWrite (LED, i)
val () = delay_ms (BLINK_DELAY_MS)
val () = if i < 255 then loop_fadein (i + 1)
}
...
val () = loop_fadein 0
Safety 2. DML dependent typesSafety 2. DML dependent typesSafety 2. DML dependent typesSafety 2. DML dependent typesSafety 2. DML dependent types
"size_t (i)" is a type that depends on
static value "i". "i" has constraint "i < n".
If the constraint is not solved, it causes
compile error.
"size_t (i)" is a type that depends on
static value "i". "i" has constraint "i < n".
If the constraint is not solved, it causes
compile error.
"size_t (i)" is a type that depends on
static value "i". "i" has constraint "i < n".
If the constraint is not solved, it causes
compile error.
"size_t (i)" is a type that depends on
static value "i". "i" has constraint "i < n".
If the constraint is not solved, it causes
compile error.
"size_t (i)" is a type that depends on
static value "i". "i" has constraint "i < n".
If the constraint is not solved, it causes
compile error.
fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n}
(lcd: !lcd_t, str: string (n), start: size_t (i),
len: size_t (j)): void
fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n}
(lcd: !lcd_t, str: string (n), start: size_t (i),
len: size_t (j)): void
fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n}
(lcd: !lcd_t, str: string (n), start: size_t (i),
len: size_t (j)): void
fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n}
(lcd: !lcd_t, str: string (n), start: size_t (i),
len: size_t (j)): void
fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n}
(lcd: !lcd_t, str: string (n), start: size_t (i),
len: size_t (j)): void
Safety 3. ViewSafety 3. ViewSafety 3. ViewSafety 3. ViewSafety 3. View
Linear proofs should be produced and
consumed.
Linear proofs should be produced and
consumed.
Linear proofs should be produced and
consumed.
Linear proofs should be produced and
consumed.
Linear proofs should be produced and
consumed.
If a produced linear proof is not
consumed, it causes type error at
compile time.
If a produced linear proof is not
consumed, it causes type error at
compile time.
If a produced linear proof is not
consumed, it causes type error at
compile time.
If a produced linear proof is not
consumed, it causes type error at
compile time.
If a produced linear proof is not
consumed, it causes type error at
compile time.
// lcd.sats - Library interface
absvtype lcd_t = ptr
fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int,
d2: int, d3: int): lcd_t // Produce linear value
fun lcd_close (lcd: lcd_t): void // Consume linear value
// main.dats - Application code
implement main () = {
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
// ...Do something...
val () = lcd_close lcd // <= If not, compile error occurs.
}
// lcd.sats - Library interface
absvtype lcd_t = ptr
fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int,
d2: int, d3: int): lcd_t // Produce linear value
fun lcd_close (lcd: lcd_t): void // Consume linear value
// main.dats - Application code
implement main () = {
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
// ...Do something...
val () = lcd_close lcd // <= If not, compile error occurs.
}
// lcd.sats - Library interface
absvtype lcd_t = ptr
fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int,
d2: int, d3: int): lcd_t // Produce linear value
fun lcd_close (lcd: lcd_t): void // Consume linear value
// main.dats - Application code
implement main () = {
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
// ...Do something...
val () = lcd_close lcd // <= If not, compile error occurs.
}
// lcd.sats - Library interface
absvtype lcd_t = ptr
fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int,
d2: int, d3: int): lcd_t // Produce linear value
fun lcd_close (lcd: lcd_t): void // Consume linear value
// main.dats - Application code
implement main () = {
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
// ...Do something...
val () = lcd_close lcd // <= If not, compile error occurs.
}
// lcd.sats - Library interface
absvtype lcd_t = ptr
fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int,
d2: int, d3: int): lcd_t // Produce linear value
fun lcd_close (lcd: lcd_t): void // Consume linear value
// main.dats - Application code
implement main () = {
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
// ...Do something...
val () = lcd_close lcd // <= If not, compile error occurs.
}
Safety 4. At-viewSafety 4. At-viewSafety 4. At-viewSafety 4. At-viewSafety 4. At-view
dataview array_v (a:t@ype+, addr, int) =
| {l:addr} array_v_nil (a, l, 0)
| {l:addr}{n:nat} array_v_cons (a, l, n+1) of
(a @ l, array_v (a, l+sizeof(a), n))
dataview array_v (a:t@ype+, addr, int) =
| {l:addr} array_v_nil (a, l, 0)
| {l:addr}{n:nat} array_v_cons (a, l, n+1) of
(a @ l, array_v (a, l+sizeof(a), n))
dataview array_v (a:t@ype+, addr, int) =
| {l:addr} array_v_nil (a, l, 0)
| {l:addr}{n:nat} array_v_cons (a, l, n+1) of
(a @ l, array_v (a, l+sizeof(a), n))
dataview array_v (a:t@ype+, addr, int) =
| {l:addr} array_v_nil (a, l, 0)
| {l:addr}{n:nat} array_v_cons (a, l, n+1) of
(a @ l, array_v (a, l+sizeof(a), n))
dataview array_v (a:t@ype+, addr, int) =
| {l:addr} array_v_nil (a, l, 0)
| {l:addr}{n:nat} array_v_cons (a, l, n+1) of
(a @ l, array_v (a, l+sizeof(a), n))
Demo code: LED fadeinDemo code: LED fadeinDemo code: LED fadeinDemo code: LED fadeinDemo code: LED fadein
#define LED 9
#define DELAY_MS 10.0
typedef analog_w_t = natLt(256)
fun{} int_foreach_clo{n:nat}
(n: int(n), fwork: &natLt(n) -<clo1> void): void =
loop(0, fwork) where {
fun loop{i:nat | i <= n} .<n-i>.
(i: int(i), fwork: &natLt(n) -<clo1> void): void =
if i < n then (fwork(i); loop (i+1, fwork))
}
implement main () = {
fun fadein() = let
var fwork = lam@ (n: analog_w_t) =>
(analogWrite (LED, n); delay_ms(DELAY_MS))
in
int_foreach_clo(256, fwork)
end // end of [fadein]
val () = pinMode (LED, OUTPUT)
val () = (fix f(): void => (fadein(); f()))()
}
#define LED 9
#define DELAY_MS 10.0
typedef analog_w_t = natLt(256)
fun{} int_foreach_clo{n:nat}
(n: int(n), fwork: &natLt(n) -<clo1> void): void =
loop(0, fwork) where {
fun loop{i:nat | i <= n} .<n-i>.
(i: int(i), fwork: &natLt(n) -<clo1> void): void =
if i < n then (fwork(i); loop (i+1, fwork))
}
implement main () = {
fun fadein() = let
var fwork = lam@ (n: analog_w_t) =>
(analogWrite (LED, n); delay_ms(DELAY_MS))
in
int_foreach_clo(256, fwork)
end // end of [fadein]
val () = pinMode (LED, OUTPUT)
val () = (fix f(): void => (fadein(); f()))()
}
#define LED 9
#define DELAY_MS 10.0
typedef analog_w_t = natLt(256)
fun{} int_foreach_clo{n:nat}
(n: int(n), fwork: &natLt(n) -<clo1> void): void =
loop(0, fwork) where {
fun loop{i:nat | i <= n} .<n-i>.
(i: int(i), fwork: &natLt(n) -<clo1> void): void =
if i < n then (fwork(i); loop (i+1, fwork))
}
implement main () = {
fun fadein() = let
var fwork = lam@ (n: analog_w_t) =>
(analogWrite (LED, n); delay_ms(DELAY_MS))
in
int_foreach_clo(256, fwork)
end // end of [fadein]
val () = pinMode (LED, OUTPUT)
val () = (fix f(): void => (fadein(); f()))()
}
#define LED 9
#define DELAY_MS 10.0
typedef analog_w_t = natLt(256)
fun{} int_foreach_clo{n:nat}
(n: int(n), fwork: &natLt(n) -<clo1> void): void =
loop(0, fwork) where {
fun loop{i:nat | i <= n} .<n-i>.
(i: int(i), fwork: &natLt(n) -<clo1> void): void =
if i < n then (fwork(i); loop (i+1, fwork))
}
implement main () = {
fun fadein() = let
var fwork = lam@ (n: analog_w_t) =>
(analogWrite (LED, n); delay_ms(DELAY_MS))
in
int_foreach_clo(256, fwork)
end // end of [fadein]
val () = pinMode (LED, OUTPUT)
val () = (fix f(): void => (fadein(); f()))()
}
#define LED 9
#define DELAY_MS 10.0
typedef analog_w_t = natLt(256)
fun{} int_foreach_clo{n:nat}
(n: int(n), fwork: &natLt(n) -<clo1> void): void =
loop(0, fwork) where {
fun loop{i:nat | i <= n} .<n-i>.
(i: int(i), fwork: &natLt(n) -<clo1> void): void =
if i < n then (fwork(i); loop (i+1, fwork))
}
implement main () = {
fun fadein() = let
var fwork = lam@ (n: analog_w_t) =>
(analogWrite (LED, n); delay_ms(DELAY_MS))
in
int_foreach_clo(256, fwork)
end // end of [fadein]
val () = pinMode (LED, OUTPUT)
val () = (fix f(): void => (fadein(); f()))()
}
Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)
#define MY_DELAY_MS 400.0
#define LCD_WIDTH 16
val g_str_atsrun = "<ATS running!>"
val g_str_message = "...Greeting message..."
implement main () = {
fun loop {n:int}{i:nat | i < n} .<n-i>.
(lcd: !lcd_t, str: string (n), pos: size_t (i)): void = {
val () = if pos + i2sz LCD_WIDTH <= length str then {
val () = lcd_setCursor (lcd, 1, 0)
val () = lcd_print (lcd, g_str_atsrun, i2sz 0,
length g_str_atsrun)
val () = lcd_setCursor (lcd, 0, 1)
val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH)
val () = delay_ms (MY_DELAY_MS)
val () = loop (lcd, str, pos + 1)
}
}
#define MY_DELAY_MS 400.0
#define LCD_WIDTH 16
val g_str_atsrun = "<ATS running!>"
val g_str_message = "...Greeting message..."
implement main () = {
fun loop {n:int}{i:nat | i < n} .<n-i>.
(lcd: !lcd_t, str: string (n), pos: size_t (i)): void = {
val () = if pos + i2sz LCD_WIDTH <= length str then {
val () = lcd_setCursor (lcd, 1, 0)
val () = lcd_print (lcd, g_str_atsrun, i2sz 0,
length g_str_atsrun)
val () = lcd_setCursor (lcd, 0, 1)
val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH)
val () = delay_ms (MY_DELAY_MS)
val () = loop (lcd, str, pos + 1)
}
}
#define MY_DELAY_MS 400.0
#define LCD_WIDTH 16
val g_str_atsrun = "<ATS running!>"
val g_str_message = "...Greeting message..."
implement main () = {
fun loop {n:int}{i:nat | i < n} .<n-i>.
(lcd: !lcd_t, str: string (n), pos: size_t (i)): void = {
val () = if pos + i2sz LCD_WIDTH <= length str then {
val () = lcd_setCursor (lcd, 1, 0)
val () = lcd_print (lcd, g_str_atsrun, i2sz 0,
length g_str_atsrun)
val () = lcd_setCursor (lcd, 0, 1)
val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH)
val () = delay_ms (MY_DELAY_MS)
val () = loop (lcd, str, pos + 1)
}
}
#define MY_DELAY_MS 400.0
#define LCD_WIDTH 16
val g_str_atsrun = "<ATS running!>"
val g_str_message = "...Greeting message..."
implement main () = {
fun loop {n:int}{i:nat | i < n} .<n-i>.
(lcd: !lcd_t, str: string (n), pos: size_t (i)): void = {
val () = if pos + i2sz LCD_WIDTH <= length str then {
val () = lcd_setCursor (lcd, 1, 0)
val () = lcd_print (lcd, g_str_atsrun, i2sz 0,
length g_str_atsrun)
val () = lcd_setCursor (lcd, 0, 1)
val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH)
val () = delay_ms (MY_DELAY_MS)
val () = loop (lcd, str, pos + 1)
}
}
#define MY_DELAY_MS 400.0
#define LCD_WIDTH 16
val g_str_atsrun = "<ATS running!>"
val g_str_message = "...Greeting message..."
implement main () = {
fun loop {n:int}{i:nat | i < n} .<n-i>.
(lcd: !lcd_t, str: string (n), pos: size_t (i)): void = {
val () = if pos + i2sz LCD_WIDTH <= length str then {
val () = lcd_setCursor (lcd, 1, 0)
val () = lcd_print (lcd, g_str_atsrun, i2sz 0,
length g_str_atsrun)
val () = lcd_setCursor (lcd, 0, 1)
val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH)
val () = delay_ms (MY_DELAY_MS)
val () = loop (lcd, str, pos + 1)
}
}
Demo code: LCD greetingDemo code: LCD greetingDemo code: LCD greetingDemo code: LCD greetingDemo code: LCD greeting
fun forever {n:int}{i:nat | i < n}
(lcd: !lcd_t, str: string (n), pos: size_t (i)):
void = {
val () = loop (lcd, str, pos)
val () = forever (lcd, str, pos)
}
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
val () = forever (lcd, g_str_message, i2sz 0)
val () = lcd_close lcd
}
fun forever {n:int}{i:nat | i < n}
(lcd: !lcd_t, str: string (n), pos: size_t (i)):
void = {
val () = loop (lcd, str, pos)
val () = forever (lcd, str, pos)
}
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
val () = forever (lcd, g_str_message, i2sz 0)
val () = lcd_close lcd
}
fun forever {n:int}{i:nat | i < n}
(lcd: !lcd_t, str: string (n), pos: size_t (i)):
void = {
val () = loop (lcd, str, pos)
val () = forever (lcd, str, pos)
}
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
val () = forever (lcd, g_str_message, i2sz 0)
val () = lcd_close lcd
}
fun forever {n:int}{i:nat | i < n}
(lcd: !lcd_t, str: string (n), pos: size_t (i)):
void = {
val () = loop (lcd, str, pos)
val () = forever (lcd, str, pos)
}
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
val () = forever (lcd, g_str_message, i2sz 0)
val () = lcd_close lcd
}
fun forever {n:int}{i:nat | i < n}
(lcd: !lcd_t, str: string (n), pos: size_t (i)):
void = {
val () = loop (lcd, str, pos)
val () = forever (lcd, str, pos)
}
val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7)
val () = forever (lcd, g_str_message, i2sz 0)
val () = lcd_close lcd
}
Binary size efficiencyBinary size efficiencyBinary size efficiencyBinary size efficiencyBinary size efficiency
For examples on "Getting Started with
Arduino", ATS has good binary size
efficiency as well as C.
For examples on "Getting Started with
Arduino", ATS has good binary size
efficiency as well as C.
For examples on "Getting Started with
Arduino", ATS has good binary size
efficiency as well as C.
For examples on "Getting Started with
Arduino", ATS has good binary size
efficiency as well as C.
For examples on "Getting Started with
Arduino", ATS has good binary size
efficiency as well as C.
ConclusionConclusionConclusionConclusionConclusion
☆ Can we directly use functional style
programming on embedded system?
☆ Can we directly use functional style
programming on embedded system?
☆ Can we directly use functional style
programming on embedded system?
☆ Can we directly use functional style
programming on embedded system?
☆ Can we directly use functional style
programming on embedded system?
☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.
☆ Can we make more safety than C
language on embedded system?
☆ Can we make more safety than C
language on embedded system?
☆ Can we make more safety than C
language on embedded system?
☆ Can we make more safety than C
language on embedded system?
☆ Can we make more safety than C
language on embedded system?
☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.
https://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-ats
License of photos #1License of photos #1License of photos #1License of photos #1License of photos #1
* Minecraft toys | Flickr - Photo Sharing!
https://www.flickr.com/photos/sergesegal/15976451410/
Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0
* Arduino Uno | Flickr - Photo Sharing!
https://www.flickr.com/photos/snootlab/6052455554/
Copyright: Snootlab / License: CC BY 2.0
* Thank You Dennis Ritchie | Flickr - Photo Sharing!
https://www.flickr.com/photos/vincentpants/6239875256/
Copyright: Vincent van Haaff / License: CC BY-SA 2.0
* Climbing Journal Mount Rinjani package | Flickr - Photo Sharing!
https://www.flickr.com/photos/trekkingrinjani/4930552641/
Copyright: Trekking Rinjani / License: CC BY 2.0
* Recycling Grunge Sign | Flickr - Photo Sharing!
https://www.flickr.com/photos/80497449@N04/8677649972/
Copyright: Nicolas Raymond / License: CC BY 2.0
* IMG_4097 | Flickr - Photo Sharing!
https://www.flickr.com/photos/matthewpiatt/1562708158/
Copyright: Matthew Piatt / License: CC BY-SA 2.0
* Seagulls in Flight | Flickr - Photo Sharing!
https://www.flickr.com/photos/87007001@N04/13513835453/
Copyright: Shaun Fisher / License: CC BY 2.0
* Minecraft toys | Flickr - Photo Sharing!
https://www.flickr.com/photos/sergesegal/15976451410/
Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0
* Arduino Uno | Flickr - Photo Sharing!
https://www.flickr.com/photos/snootlab/6052455554/
Copyright: Snootlab / License: CC BY 2.0
* Thank You Dennis Ritchie | Flickr - Photo Sharing!
https://www.flickr.com/photos/vincentpants/6239875256/
Copyright: Vincent van Haaff / License: CC BY-SA 2.0
* Climbing Journal Mount Rinjani package | Flickr - Photo Sharing!
https://www.flickr.com/photos/trekkingrinjani/4930552641/
Copyright: Trekking Rinjani / License: CC BY 2.0
* Recycling Grunge Sign | Flickr - Photo Sharing!
https://www.flickr.com/photos/80497449@N04/8677649972/
Copyright: Nicolas Raymond / License: CC BY 2.0
* IMG_4097 | Flickr - Photo Sharing!
https://www.flickr.com/photos/matthewpiatt/1562708158/
Copyright: Matthew Piatt / License: CC BY-SA 2.0
* Seagulls in Flight | Flickr - Photo Sharing!
https://www.flickr.com/photos/87007001@N04/13513835453/
Copyright: Shaun Fisher / License: CC BY 2.0
* Minecraft toys | Flickr - Photo Sharing!
https://www.flickr.com/photos/sergesegal/15976451410/
Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0
* Arduino Uno | Flickr - Photo Sharing!
https://www.flickr.com/photos/snootlab/6052455554/
Copyright: Snootlab / License: CC BY 2.0
* Thank You Dennis Ritchie | Flickr - Photo Sharing!
https://www.flickr.com/photos/vincentpants/6239875256/
Copyright: Vincent van Haaff / License: CC BY-SA 2.0
* Climbing Journal Mount Rinjani package | Flickr - Photo Sharing!
https://www.flickr.com/photos/trekkingrinjani/4930552641/
Copyright: Trekking Rinjani / License: CC BY 2.0
* Recycling Grunge Sign | Flickr - Photo Sharing!
https://www.flickr.com/photos/80497449@N04/8677649972/
Copyright: Nicolas Raymond / License: CC BY 2.0
* IMG_4097 | Flickr - Photo Sharing!
https://www.flickr.com/photos/matthewpiatt/1562708158/
Copyright: Matthew Piatt / License: CC BY-SA 2.0
* Seagulls in Flight | Flickr - Photo Sharing!
https://www.flickr.com/photos/87007001@N04/13513835453/
Copyright: Shaun Fisher / License: CC BY 2.0
* Minecraft toys | Flickr - Photo Sharing!
https://www.flickr.com/photos/sergesegal/15976451410/
Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0
* Arduino Uno | Flickr - Photo Sharing!
https://www.flickr.com/photos/snootlab/6052455554/
Copyright: Snootlab / License: CC BY 2.0
* Thank You Dennis Ritchie | Flickr - Photo Sharing!
https://www.flickr.com/photos/vincentpants/6239875256/
Copyright: Vincent van Haaff / License: CC BY-SA 2.0
* Climbing Journal Mount Rinjani package | Flickr - Photo Sharing!
https://www.flickr.com/photos/trekkingrinjani/4930552641/
Copyright: Trekking Rinjani / License: CC BY 2.0
* Recycling Grunge Sign | Flickr - Photo Sharing!
https://www.flickr.com/photos/80497449@N04/8677649972/
Copyright: Nicolas Raymond / License: CC BY 2.0
* IMG_4097 | Flickr - Photo Sharing!
https://www.flickr.com/photos/matthewpiatt/1562708158/
Copyright: Matthew Piatt / License: CC BY-SA 2.0
* Seagulls in Flight | Flickr - Photo Sharing!
https://www.flickr.com/photos/87007001@N04/13513835453/
Copyright: Shaun Fisher / License: CC BY 2.0
* Minecraft toys | Flickr - Photo Sharing!
https://www.flickr.com/photos/sergesegal/15976451410/
Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0
* Arduino Uno | Flickr - Photo Sharing!
https://www.flickr.com/photos/snootlab/6052455554/
Copyright: Snootlab / License: CC BY 2.0
* Thank You Dennis Ritchie | Flickr - Photo Sharing!
https://www.flickr.com/photos/vincentpants/6239875256/
Copyright: Vincent van Haaff / License: CC BY-SA 2.0
* Climbing Journal Mount Rinjani package | Flickr - Photo Sharing!
https://www.flickr.com/photos/trekkingrinjani/4930552641/
Copyright: Trekking Rinjani / License: CC BY 2.0
* Recycling Grunge Sign | Flickr - Photo Sharing!
https://www.flickr.com/photos/80497449@N04/8677649972/
Copyright: Nicolas Raymond / License: CC BY 2.0
* IMG_4097 | Flickr - Photo Sharing!
https://www.flickr.com/photos/matthewpiatt/1562708158/
Copyright: Matthew Piatt / License: CC BY-SA 2.0
* Seagulls in Flight | Flickr - Photo Sharing!
https://www.flickr.com/photos/87007001@N04/13513835453/
Copyright: Shaun Fisher / License: CC BY 2.0
License of photos #2License of photos #2License of photos #2License of photos #2License of photos #2
* Arduino Uno unboxing | Flickr - Photo Sharing!
https://www.flickr.com/photos/mightyohm/5052594028/
Copyright: Jeff Keyzer / License: CC BY-SA 2.0
* Creative Commons BBB | Flickr - Photo Sharing!
https://www.flickr.com/photos/steren/2732488224/
Copyright: Steren Giannini / License: CC BY 2.0
* LED | Flickr - Photo Sharing!
https://www.flickr.com/photos/nao904/6084536885/
Copyright: Nao. Fujita / License: CC BY 2.0
* Pagoda's curly steps | Flickr - Photo Sharing!
https://www.flickr.com/photos/kewl/6834141860/
Copyright: Tristan Schmurr / License: CC BY 2.0
* Arduino Uno unboxing | Flickr - Photo Sharing!
https://www.flickr.com/photos/mightyohm/5052594028/
Copyright: Jeff Keyzer / License: CC BY-SA 2.0
* Creative Commons BBB | Flickr - Photo Sharing!
https://www.flickr.com/photos/steren/2732488224/
Copyright: Steren Giannini / License: CC BY 2.0
* LED | Flickr - Photo Sharing!
https://www.flickr.com/photos/nao904/6084536885/
Copyright: Nao. Fujita / License: CC BY 2.0
* Pagoda's curly steps | Flickr - Photo Sharing!
https://www.flickr.com/photos/kewl/6834141860/
Copyright: Tristan Schmurr / License: CC BY 2.0
* Arduino Uno unboxing | Flickr - Photo Sharing!
https://www.flickr.com/photos/mightyohm/5052594028/
Copyright: Jeff Keyzer / License: CC BY-SA 2.0
* Creative Commons BBB | Flickr - Photo Sharing!
https://www.flickr.com/photos/steren/2732488224/
Copyright: Steren Giannini / License: CC BY 2.0
* LED | Flickr - Photo Sharing!
https://www.flickr.com/photos/nao904/6084536885/
Copyright: Nao. Fujita / License: CC BY 2.0
* Pagoda's curly steps | Flickr - Photo Sharing!
https://www.flickr.com/photos/kewl/6834141860/
Copyright: Tristan Schmurr / License: CC BY 2.0
* Arduino Uno unboxing | Flickr - Photo Sharing!
https://www.flickr.com/photos/mightyohm/5052594028/
Copyright: Jeff Keyzer / License: CC BY-SA 2.0
* Creative Commons BBB | Flickr - Photo Sharing!
https://www.flickr.com/photos/steren/2732488224/
Copyright: Steren Giannini / License: CC BY 2.0
* LED | Flickr - Photo Sharing!
https://www.flickr.com/photos/nao904/6084536885/
Copyright: Nao. Fujita / License: CC BY 2.0
* Pagoda's curly steps | Flickr - Photo Sharing!
https://www.flickr.com/photos/kewl/6834141860/
Copyright: Tristan Schmurr / License: CC BY 2.0
* Arduino Uno unboxing | Flickr - Photo Sharing!
https://www.flickr.com/photos/mightyohm/5052594028/
Copyright: Jeff Keyzer / License: CC BY-SA 2.0
* Creative Commons BBB | Flickr - Photo Sharing!
https://www.flickr.com/photos/steren/2732488224/
Copyright: Steren Giannini / License: CC BY 2.0
* LED | Flickr - Photo Sharing!
https://www.flickr.com/photos/nao904/6084536885/
Copyright: Nao. Fujita / License: CC BY 2.0
* Pagoda's curly steps | Flickr - Photo Sharing!
https://www.flickr.com/photos/kewl/6834141860/
Copyright: Tristan Schmurr / License: CC BY 2.0

More Related Content

What's hot

Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS languageKiwamu Okabe
 
Metasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoMetasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoKiwamu Okabe
 
ATS Programming Tutorial
ATS Programming TutorialATS Programming Tutorial
ATS Programming TutorialKiwamu Okabe
 
Functional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformFunctional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformKiwamu Okabe
 
ATS programming on ESP8266
ATS programming on ESP8266ATS programming on ESP8266
ATS programming on ESP8266Kiwamu Okabe
 
Functional IoT: Programming Language and OS
Functional IoT: Programming Language and OSFunctional IoT: Programming Language and OS
Functional IoT: Programming Language and OSKiwamu Okabe
 
Functional IoT: Introduction
Functional IoT: IntroductionFunctional IoT: Introduction
Functional IoT: IntroductionKiwamu Okabe
 
Past and today of Metasepi project
Past and today of Metasepi projectPast and today of Metasepi project
Past and today of Metasepi projectKiwamu Okabe
 
Dear compiler please don't be my nanny v2
Dear compiler  please don't be my nanny v2Dear compiler  please don't be my nanny v2
Dear compiler please don't be my nanny v2Dino Dini
 
Spring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsSpring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsJarek Ratajski
 
Make Your Own Perl with Moops
Make Your Own Perl with MoopsMake Your Own Perl with Moops
Make Your Own Perl with MoopsMike Friedman
 
Bash is not a second zone citizen programming language
Bash is not a second zone citizen programming languageBash is not a second zone citizen programming language
Bash is not a second zone citizen programming languageRené Ribaud
 
Be pinched by a cRUSTacean to prevent programming errors !
Be pinched by a cRUSTacean to prevent programming errors !Be pinched by a cRUSTacean to prevent programming errors !
Be pinched by a cRUSTacean to prevent programming errors !René Ribaud
 
The Perl API for the Mortally Terrified (beta)
The Perl API for the Mortally Terrified (beta)The Perl API for the Mortally Terrified (beta)
The Perl API for the Mortally Terrified (beta)Mike Friedman
 
Reading Other Peoples Code (Web Rebels 2018)
Reading Other Peoples Code (Web Rebels 2018)Reading Other Peoples Code (Web Rebels 2018)
Reading Other Peoples Code (Web Rebels 2018)Patricia Aas
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?acme
 
Managing a R&D Lab with Foreman
Managing a R&D Lab with ForemanManaging a R&D Lab with Foreman
Managing a R&D Lab with ForemanJulien Pivotto
 

What's hot (20)

Embedded application designed by ATS language
Embedded application designed by ATS languageEmbedded application designed by ATS language
Embedded application designed by ATS language
 
Metasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on ArduinoMetasepi team meeting #19: ATS application on Arduino
Metasepi team meeting #19: ATS application on Arduino
 
ATS Programming Tutorial
ATS Programming TutorialATS Programming Tutorial
ATS Programming Tutorial
 
Functional IoT: Hardware and Platform
Functional IoT: Hardware and PlatformFunctional IoT: Hardware and Platform
Functional IoT: Hardware and Platform
 
ATS programming on ESP8266
ATS programming on ESP8266ATS programming on ESP8266
ATS programming on ESP8266
 
Functional IoT: Programming Language and OS
Functional IoT: Programming Language and OSFunctional IoT: Programming Language and OS
Functional IoT: Programming Language and OS
 
Functional IoT: Introduction
Functional IoT: IntroductionFunctional IoT: Introduction
Functional IoT: Introduction
 
ATS2 updates 2017
ATS2 updates 2017ATS2 updates 2017
ATS2 updates 2017
 
Past and today of Metasepi project
Past and today of Metasepi projectPast and today of Metasepi project
Past and today of Metasepi project
 
Dear compiler please don't be my nanny v2
Dear compiler  please don't be my nanny v2Dear compiler  please don't be my nanny v2
Dear compiler please don't be my nanny v2
 
Spring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good partsSpring, CDI, Jakarta EE good parts
Spring, CDI, Jakarta EE good parts
 
Perl Moderno
Perl ModernoPerl Moderno
Perl Moderno
 
Make Your Own Perl with Moops
Make Your Own Perl with MoopsMake Your Own Perl with Moops
Make Your Own Perl with Moops
 
Bash is not a second zone citizen programming language
Bash is not a second zone citizen programming languageBash is not a second zone citizen programming language
Bash is not a second zone citizen programming language
 
Be pinched by a cRUSTacean to prevent programming errors !
Be pinched by a cRUSTacean to prevent programming errors !Be pinched by a cRUSTacean to prevent programming errors !
Be pinched by a cRUSTacean to prevent programming errors !
 
Final field semantics
Final field semanticsFinal field semantics
Final field semantics
 
The Perl API for the Mortally Terrified (beta)
The Perl API for the Mortally Terrified (beta)The Perl API for the Mortally Terrified (beta)
The Perl API for the Mortally Terrified (beta)
 
Reading Other Peoples Code (Web Rebels 2018)
Reading Other Peoples Code (Web Rebels 2018)Reading Other Peoples Code (Web Rebels 2018)
Reading Other Peoples Code (Web Rebels 2018)
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?
 
Managing a R&D Lab with Foreman
Managing a R&D Lab with ForemanManaging a R&D Lab with Foreman
Managing a R&D Lab with Foreman
 

Similar to Arduino programming of ML-style in ATS

(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart Pointers(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart PointersCarlo Pescio
 
NetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf EditionNetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf EditionPaulo Morgado
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experimentAmos Wenger
 
Replace OutputIterator and Extend Range
Replace OutputIterator and Extend RangeReplace OutputIterator and Extend Range
Replace OutputIterator and Extend RangeAkira Takahashi
 
Tuga IT 2018 Summer Edition - The Future of C#
Tuga IT 2018 Summer Edition - The Future of C#Tuga IT 2018 Summer Edition - The Future of C#
Tuga IT 2018 Summer Edition - The Future of C#Paulo Morgado
 
Python 3000
Python 3000Python 3000
Python 3000Bob Chao
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsKonrad Malawski
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
 
Falcon初印象
Falcon初印象Falcon初印象
Falcon初印象勇浩 赖
 
The present and the future of functional programming in c++
The present and the future of functional programming in c++The present and the future of functional programming in c++
The present and the future of functional programming in c++Alexander Granin
 
WebSummit 2015 - Gopher it
WebSummit 2015 - Gopher itWebSummit 2015 - Gopher it
WebSummit 2015 - Gopher itGautam Rege
 
Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11John Wilker
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C BasicsBharat Kalia
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the BasicsJussi Pohjolainen
 

Similar to Arduino programming of ML-style in ATS (20)

About Go
About GoAbout Go
About Go
 
(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart Pointers(Slightly) Smarter Smart Pointers
(Slightly) Smarter Smart Pointers
 
Talk About Performance
Talk About PerformanceTalk About Performance
Talk About Performance
 
NetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf EditionNetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf Edition
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
ooc - A hybrid language experiment
ooc - A hybrid language experimentooc - A hybrid language experiment
ooc - A hybrid language experiment
 
Replace OutputIterator and Extend Range
Replace OutputIterator and Extend RangeReplace OutputIterator and Extend Range
Replace OutputIterator and Extend Range
 
Tuga IT 2018 Summer Edition - The Future of C#
Tuga IT 2018 Summer Edition - The Future of C#Tuga IT 2018 Summer Edition - The Future of C#
Tuga IT 2018 Summer Edition - The Future of C#
 
Python 3000
Python 3000Python 3000
Python 3000
 
Java 8: the good parts!
Java 8: the good parts!Java 8: the good parts!
Java 8: the good parts!
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
Falcon初印象
Falcon初印象Falcon初印象
Falcon初印象
 
The present and the future of functional programming in c++
The present and the future of functional programming in c++The present and the future of functional programming in c++
The present and the future of functional programming in c++
 
WebSummit 2015 - Gopher it
WebSummit 2015 - Gopher itWebSummit 2015 - Gopher it
WebSummit 2015 - Gopher it
 
Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11Cranking Floating Point Performance Up To 11
Cranking Floating Point Performance Up To 11
 
Programming in C Basics
Programming in C BasicsProgramming in C Basics
Programming in C Basics
 
Cbasic
CbasicCbasic
Cbasic
 
Programming with Java: the Basics
Programming with Java: the BasicsProgramming with Java: the Basics
Programming with Java: the Basics
 

Recently uploaded

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Arduino programming of ML-style in ATS

  • 1. Arduino programming of ML- style in ATS Arduino programming of ML- style in ATS Arduino programming of ML- style in ATS Arduino programming of ML- style in ATS Arduino programming of ML- style in ATS Kiwamu Okabe @ METASEPI DESIGN / Hongwei Xi @ Boston University Kiwamu Okabe @ METASEPI DESIGN / Hongwei Xi @ Boston University Kiwamu Okabe @ METASEPI DESIGN / Hongwei Xi @ Boston University Kiwamu Okabe @ METASEPI DESIGN / Hongwei Xi @ Boston University Kiwamu Okabe @ METASEPI DESIGN / Hongwei Xi @ Boston University
  • 2. Demo: VideoDemo: VideoDemo: VideoDemo: VideoDemo: Video ☆ LCD greeting☆ LCD greeting☆ LCD greeting☆ LCD greeting☆ LCD greeting ☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc☆ ⇒ http://youtu.be/5uPue0Jo1nc ☆ LED fadein☆ LED fadein☆ LED fadein☆ LED fadein☆ LED fadein ☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k☆ ⇒ http://youtu.be/_Sx6GzuTm9k
  • 3. Demo: Software ArchitectureDemo: Software ArchitectureDemo: Software ArchitectureDemo: Software ArchitectureDemo: Software Architecture
  • 4. Arduino Uno hardwareArduino Uno hardwareArduino Uno hardwareArduino Uno hardwareArduino Uno hardware It's poor.It's poor.It's poor.It's poor.It's poor. ☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture☆ 8-bit Harvard architecture ☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB☆ Flash Memory: 32 KB ☆ SRAM: 2 KB☆ SRAM: 2 KB☆ SRAM: 2 KB☆ SRAM: 2 KB☆ SRAM: 2 KB Many people use C language on the hardware. Many people use C language on the hardware. Many people use C language on the hardware. Many people use C language on the hardware. Many people use C language on the hardware.
  • 5. Problem of C languageProblem of C languageProblem of C languageProblem of C languageProblem of C language ☆ Memory/Resource leak☆ Memory/Resource leak☆ Memory/Resource leak☆ Memory/Resource leak☆ Memory/Resource leak ☆ Out of bounds☆ Out of bounds☆ Out of bounds☆ Out of bounds☆ Out of bounds ☆ Weak type☆ Weak type☆ Weak type☆ Weak type☆ Weak type We need functional language for embedded system! We need functional language for embedded system! We need functional language for embedded system! We need functional language for embedded system! We need functional language for embedded system!
  • 6. Approach 1: Virtual machineApproach 1: Virtual machineApproach 1: Virtual machineApproach 1: Virtual machineApproach 1: Virtual machine
  • 7. Approach 2: DSLApproach 2: DSLApproach 2: DSLApproach 2: DSLApproach 2: DSL
  • 8. Approach 3: Direct languageApproach 3: Direct languageApproach 3: Direct languageApproach 3: Direct languageApproach 3: Direct language
  • 9. Comparison of the approachesComparison of the approachesComparison of the approachesComparison of the approachesComparison of the approaches We choose the 3rd approach.We choose the 3rd approach.We choose the 3rd approach.We choose the 3rd approach.We choose the 3rd approach.
  • 10. ATS languageATS languageATS languageATS languageATS language ☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/☆ http://www.ats-lang.org/ ☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types☆ DML-style dependent types ☆ Linear types☆ Linear types☆ Linear types☆ Linear types☆ Linear types ☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC☆ Optional GC ☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free☆ Optional malloc/free ☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time☆ Optional run-time
  • 11. Author: Hongwei XiAuthor: Hongwei XiAuthor: Hongwei XiAuthor: Hongwei XiAuthor: Hongwei Xi
  • 12. ATS programming levelATS programming levelATS programming levelATS programming levelATS programming level Today, we focus on the level "c", because Arduino hardware is poor. Today, we focus on the level "c", because Arduino hardware is poor. Today, we focus on the level "c", because Arduino hardware is poor. Today, we focus on the level "c", because Arduino hardware is poor. Today, we focus on the level "c", because Arduino hardware is poor.
  • 13. Functional style programmingFunctional style programmingFunctional style programmingFunctional style programmingFunctional style programming ☆ Functional style programming can be used with ATS on embedded system? ☆ Functional style programming can be used with ATS on embedded system? ☆ Functional style programming can be used with ATS on embedded system? ☆ Functional style programming can be used with ATS on embedded system? ☆ Functional style programming can be used with ATS on embedded system? ☆ Yes.☆ Yes.☆ Yes.☆ Yes.☆ Yes. ☆ But only use some of functional style technique in ATS without GC and malloc/free. ☆ But only use some of functional style technique in ATS without GC and malloc/free. ☆ But only use some of functional style technique in ATS without GC and malloc/free. ☆ But only use some of functional style technique in ATS without GC and malloc/free. ☆ But only use some of functional style technique in ATS without GC and malloc/free. ☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.
  • 14. Style 1. Envless functionStyle 1. Envless functionStyle 1. Envless functionStyle 1. Envless functionStyle 1. Envless function ☆ Environment-less function.☆ Environment-less function.☆ Environment-less function.☆ Environment-less function.☆ Environment-less function. ☆ Not closure.☆ Not closure.☆ Not closure.☆ Not closure.☆ Not closure. ☆ C language function is also envless function. ☆ C language function is also envless function. ☆ C language function is also envless function. ☆ C language function is also envless function. ☆ C language function is also envless function. %{^ // C language code int cfunc(int a, int b) { return (a + b); } %} // ATS language code extern fun cfunc (a: int, b: int): int = "mac#" implement main0 () = println! (cfunc (1, 2)) // => 3 %{^ // C language code int cfunc(int a, int b) { return (a + b); } %} // ATS language code extern fun cfunc (a: int, b: int): int = "mac#" implement main0 () = println! (cfunc (1, 2)) // => 3 %{^ // C language code int cfunc(int a, int b) { return (a + b); } %} // ATS language code extern fun cfunc (a: int, b: int): int = "mac#" implement main0 () = println! (cfunc (1, 2)) // => 3 %{^ // C language code int cfunc(int a, int b) { return (a + b); } %} // ATS language code extern fun cfunc (a: int, b: int): int = "mac#" implement main0 () = println! (cfunc (1, 2)) // => 3 %{^ // C language code int cfunc(int a, int b) { return (a + b); } %} // ATS language code extern fun cfunc (a: int, b: int): int = "mac#" implement main0 () = println! (cfunc (1, 2)) // => 3
  • 15. Style 2. Stack allocated closureStyle 2. Stack allocated closureStyle 2. Stack allocated closureStyle 2. Stack allocated closureStyle 2. Stack allocated closure Stack allocated closure is allocated on stack. It can use free variable. Stack allocated closure is allocated on stack. It can use free variable. Stack allocated closure is allocated on stack. It can use free variable. Stack allocated closure is allocated on stack. It can use free variable. Stack allocated closure is allocated on stack. It can use free variable. fun run (f: &int -<clo1> int): int = f 1 implement main0 () = { val b = 2 var plus = lam@ (a: int):int => a + b val () = println! (run plus) // => 3 } fun run (f: &int -<clo1> int): int = f 1 implement main0 () = { val b = 2 var plus = lam@ (a: int):int => a + b val () = println! (run plus) // => 3 } fun run (f: &int -<clo1> int): int = f 1 implement main0 () = { val b = 2 var plus = lam@ (a: int):int => a + b val () = println! (run plus) // => 3 } fun run (f: &int -<clo1> int): int = f 1 implement main0 () = { val b = 2 var plus = lam@ (a: int):int => a + b val () = println! (run plus) // => 3 } fun run (f: &int -<clo1> int): int = f 1 implement main0 () = { val b = 2 var plus = lam@ (a: int):int => a + b val () = println! (run plus) // => 3 }
  • 16. Style 3. Template functionStyle 3. Template functionStyle 3. Template functionStyle 3. Template functionStyle 3. Template function The template is functorial style that has lexical scoping. The template is functorial style that has lexical scoping. The template is functorial style that has lexical scoping. The template is functorial style that has lexical scoping. The template is functorial style that has lexical scoping. extern fun{} base (): int fun{} plus (a: int): int = a + base () implement main0 () = { implement{} base () = 2 val () = println! (plus 1) // => 3 } extern fun{} base (): int fun{} plus (a: int): int = a + base () implement main0 () = { implement{} base () = 2 val () = println! (plus 1) // => 3 } extern fun{} base (): int fun{} plus (a: int): int = a + base () implement main0 () = { implement{} base () = 2 val () = println! (plus 1) // => 3 } extern fun{} base (): int fun{} plus (a: int): int = a + base () implement main0 () = { implement{} base () = 2 val () = println! (plus 1) // => 3 } extern fun{} base (): int fun{} plus (a: int): int = a + base () implement main0 () = { implement{} base () = 2 val () = println! (plus 1) // => 3 }
  • 17. Safety shaped by ATSSafety shaped by ATSSafety shaped by ATSSafety shaped by ATSSafety shaped by ATS ☆ ATS is a better C language.☆ ATS is a better C language.☆ ATS is a better C language.☆ ATS is a better C language.☆ ATS is a better C language. ☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer".☆ "Better" is meaning "Safer". ☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.☆ Let's see some examples.
  • 18. Safety 1. Termination metricsSafety 1. Termination metricsSafety 1. Termination metricsSafety 1. Termination metricsSafety 1. Termination metrics ".<255 - n>." is termination metric that grows smaller on each recursive call, for termination-checking. ".<255 - n>." is termination metric that grows smaller on each recursive call, for termination-checking. ".<255 - n>." is termination metric that grows smaller on each recursive call, for termination-checking. ".<255 - n>." is termination metric that grows smaller on each recursive call, for termination-checking. ".<255 - n>." is termination metric that grows smaller on each recursive call, for termination-checking. fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = { val () = analogWrite (LED, i) val () = delay_ms (BLINK_DELAY_MS) val () = if i < 255 then loop_fadein (i + 1) } ... val () = loop_fadein 0 fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = { val () = analogWrite (LED, i) val () = delay_ms (BLINK_DELAY_MS) val () = if i < 255 then loop_fadein (i + 1) } ... val () = loop_fadein 0 fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = { val () = analogWrite (LED, i) val () = delay_ms (BLINK_DELAY_MS) val () = if i < 255 then loop_fadein (i + 1) } ... val () = loop_fadein 0 fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = { val () = analogWrite (LED, i) val () = delay_ms (BLINK_DELAY_MS) val () = if i < 255 then loop_fadein (i + 1) } ... val () = loop_fadein 0 fun loop_fadein {n:nat | n <= 255} .<255 - n>. (i: int n): void = { val () = analogWrite (LED, i) val () = delay_ms (BLINK_DELAY_MS) val () = if i < 255 then loop_fadein (i + 1) } ... val () = loop_fadein 0
  • 19. Safety 2. DML dependent typesSafety 2. DML dependent typesSafety 2. DML dependent typesSafety 2. DML dependent typesSafety 2. DML dependent types "size_t (i)" is a type that depends on static value "i". "i" has constraint "i < n". If the constraint is not solved, it causes compile error. "size_t (i)" is a type that depends on static value "i". "i" has constraint "i < n". If the constraint is not solved, it causes compile error. "size_t (i)" is a type that depends on static value "i". "i" has constraint "i < n". If the constraint is not solved, it causes compile error. "size_t (i)" is a type that depends on static value "i". "i" has constraint "i < n". If the constraint is not solved, it causes compile error. "size_t (i)" is a type that depends on static value "i". "i" has constraint "i < n". If the constraint is not solved, it causes compile error. fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n} (lcd: !lcd_t, str: string (n), start: size_t (i), len: size_t (j)): void fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n} (lcd: !lcd_t, str: string (n), start: size_t (i), len: size_t (j)): void fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n} (lcd: !lcd_t, str: string (n), start: size_t (i), len: size_t (j)): void fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n} (lcd: !lcd_t, str: string (n), start: size_t (i), len: size_t (j)): void fun lcd_print {n:int}{i:nat | i < n}{j:nat | i + j <= n} (lcd: !lcd_t, str: string (n), start: size_t (i), len: size_t (j)): void
  • 20. Safety 3. ViewSafety 3. ViewSafety 3. ViewSafety 3. ViewSafety 3. View Linear proofs should be produced and consumed. Linear proofs should be produced and consumed. Linear proofs should be produced and consumed. Linear proofs should be produced and consumed. Linear proofs should be produced and consumed. If a produced linear proof is not consumed, it causes type error at compile time. If a produced linear proof is not consumed, it causes type error at compile time. If a produced linear proof is not consumed, it causes type error at compile time. If a produced linear proof is not consumed, it causes type error at compile time. If a produced linear proof is not consumed, it causes type error at compile time. // lcd.sats - Library interface absvtype lcd_t = ptr fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int, d2: int, d3: int): lcd_t // Produce linear value fun lcd_close (lcd: lcd_t): void // Consume linear value // main.dats - Application code implement main () = { val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) // ...Do something... val () = lcd_close lcd // <= If not, compile error occurs. } // lcd.sats - Library interface absvtype lcd_t = ptr fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int, d2: int, d3: int): lcd_t // Produce linear value fun lcd_close (lcd: lcd_t): void // Consume linear value // main.dats - Application code implement main () = { val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) // ...Do something... val () = lcd_close lcd // <= If not, compile error occurs. } // lcd.sats - Library interface absvtype lcd_t = ptr fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int, d2: int, d3: int): lcd_t // Produce linear value fun lcd_close (lcd: lcd_t): void // Consume linear value // main.dats - Application code implement main () = { val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) // ...Do something... val () = lcd_close lcd // <= If not, compile error occurs. } // lcd.sats - Library interface absvtype lcd_t = ptr fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int, d2: int, d3: int): lcd_t // Produce linear value fun lcd_close (lcd: lcd_t): void // Consume linear value // main.dats - Application code implement main () = { val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) // ...Do something... val () = lcd_close lcd // <= If not, compile error occurs. } // lcd.sats - Library interface absvtype lcd_t = ptr fun lcd_open (rs: int, rw: int, enable: int, d0: int, d1: int, d2: int, d3: int): lcd_t // Produce linear value fun lcd_close (lcd: lcd_t): void // Consume linear value // main.dats - Application code implement main () = { val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) // ...Do something... val () = lcd_close lcd // <= If not, compile error occurs. }
  • 21. Safety 4. At-viewSafety 4. At-viewSafety 4. At-viewSafety 4. At-viewSafety 4. At-view dataview array_v (a:t@ype+, addr, int) = | {l:addr} array_v_nil (a, l, 0) | {l:addr}{n:nat} array_v_cons (a, l, n+1) of (a @ l, array_v (a, l+sizeof(a), n)) dataview array_v (a:t@ype+, addr, int) = | {l:addr} array_v_nil (a, l, 0) | {l:addr}{n:nat} array_v_cons (a, l, n+1) of (a @ l, array_v (a, l+sizeof(a), n)) dataview array_v (a:t@ype+, addr, int) = | {l:addr} array_v_nil (a, l, 0) | {l:addr}{n:nat} array_v_cons (a, l, n+1) of (a @ l, array_v (a, l+sizeof(a), n)) dataview array_v (a:t@ype+, addr, int) = | {l:addr} array_v_nil (a, l, 0) | {l:addr}{n:nat} array_v_cons (a, l, n+1) of (a @ l, array_v (a, l+sizeof(a), n)) dataview array_v (a:t@ype+, addr, int) = | {l:addr} array_v_nil (a, l, 0) | {l:addr}{n:nat} array_v_cons (a, l, n+1) of (a @ l, array_v (a, l+sizeof(a), n))
  • 22. Demo code: LED fadeinDemo code: LED fadeinDemo code: LED fadeinDemo code: LED fadeinDemo code: LED fadein #define LED 9 #define DELAY_MS 10.0 typedef analog_w_t = natLt(256) fun{} int_foreach_clo{n:nat} (n: int(n), fwork: &natLt(n) -<clo1> void): void = loop(0, fwork) where { fun loop{i:nat | i <= n} .<n-i>. (i: int(i), fwork: &natLt(n) -<clo1> void): void = if i < n then (fwork(i); loop (i+1, fwork)) } implement main () = { fun fadein() = let var fwork = lam@ (n: analog_w_t) => (analogWrite (LED, n); delay_ms(DELAY_MS)) in int_foreach_clo(256, fwork) end // end of [fadein] val () = pinMode (LED, OUTPUT) val () = (fix f(): void => (fadein(); f()))() } #define LED 9 #define DELAY_MS 10.0 typedef analog_w_t = natLt(256) fun{} int_foreach_clo{n:nat} (n: int(n), fwork: &natLt(n) -<clo1> void): void = loop(0, fwork) where { fun loop{i:nat | i <= n} .<n-i>. (i: int(i), fwork: &natLt(n) -<clo1> void): void = if i < n then (fwork(i); loop (i+1, fwork)) } implement main () = { fun fadein() = let var fwork = lam@ (n: analog_w_t) => (analogWrite (LED, n); delay_ms(DELAY_MS)) in int_foreach_clo(256, fwork) end // end of [fadein] val () = pinMode (LED, OUTPUT) val () = (fix f(): void => (fadein(); f()))() } #define LED 9 #define DELAY_MS 10.0 typedef analog_w_t = natLt(256) fun{} int_foreach_clo{n:nat} (n: int(n), fwork: &natLt(n) -<clo1> void): void = loop(0, fwork) where { fun loop{i:nat | i <= n} .<n-i>. (i: int(i), fwork: &natLt(n) -<clo1> void): void = if i < n then (fwork(i); loop (i+1, fwork)) } implement main () = { fun fadein() = let var fwork = lam@ (n: analog_w_t) => (analogWrite (LED, n); delay_ms(DELAY_MS)) in int_foreach_clo(256, fwork) end // end of [fadein] val () = pinMode (LED, OUTPUT) val () = (fix f(): void => (fadein(); f()))() } #define LED 9 #define DELAY_MS 10.0 typedef analog_w_t = natLt(256) fun{} int_foreach_clo{n:nat} (n: int(n), fwork: &natLt(n) -<clo1> void): void = loop(0, fwork) where { fun loop{i:nat | i <= n} .<n-i>. (i: int(i), fwork: &natLt(n) -<clo1> void): void = if i < n then (fwork(i); loop (i+1, fwork)) } implement main () = { fun fadein() = let var fwork = lam@ (n: analog_w_t) => (analogWrite (LED, n); delay_ms(DELAY_MS)) in int_foreach_clo(256, fwork) end // end of [fadein] val () = pinMode (LED, OUTPUT) val () = (fix f(): void => (fadein(); f()))() } #define LED 9 #define DELAY_MS 10.0 typedef analog_w_t = natLt(256) fun{} int_foreach_clo{n:nat} (n: int(n), fwork: &natLt(n) -<clo1> void): void = loop(0, fwork) where { fun loop{i:nat | i <= n} .<n-i>. (i: int(i), fwork: &natLt(n) -<clo1> void): void = if i < n then (fwork(i); loop (i+1, fwork)) } implement main () = { fun fadein() = let var fwork = lam@ (n: analog_w_t) => (analogWrite (LED, n); delay_ms(DELAY_MS)) in int_foreach_clo(256, fwork) end // end of [fadein] val () = pinMode (LED, OUTPUT) val () = (fix f(): void => (fadein(); f()))() }
  • 23. Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.)Demo code: LCD greeting (cont.) #define MY_DELAY_MS 400.0 #define LCD_WIDTH 16 val g_str_atsrun = "<ATS running!>" val g_str_message = "...Greeting message..." implement main () = { fun loop {n:int}{i:nat | i < n} .<n-i>. (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = if pos + i2sz LCD_WIDTH <= length str then { val () = lcd_setCursor (lcd, 1, 0) val () = lcd_print (lcd, g_str_atsrun, i2sz 0, length g_str_atsrun) val () = lcd_setCursor (lcd, 0, 1) val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH) val () = delay_ms (MY_DELAY_MS) val () = loop (lcd, str, pos + 1) } } #define MY_DELAY_MS 400.0 #define LCD_WIDTH 16 val g_str_atsrun = "<ATS running!>" val g_str_message = "...Greeting message..." implement main () = { fun loop {n:int}{i:nat | i < n} .<n-i>. (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = if pos + i2sz LCD_WIDTH <= length str then { val () = lcd_setCursor (lcd, 1, 0) val () = lcd_print (lcd, g_str_atsrun, i2sz 0, length g_str_atsrun) val () = lcd_setCursor (lcd, 0, 1) val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH) val () = delay_ms (MY_DELAY_MS) val () = loop (lcd, str, pos + 1) } } #define MY_DELAY_MS 400.0 #define LCD_WIDTH 16 val g_str_atsrun = "<ATS running!>" val g_str_message = "...Greeting message..." implement main () = { fun loop {n:int}{i:nat | i < n} .<n-i>. (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = if pos + i2sz LCD_WIDTH <= length str then { val () = lcd_setCursor (lcd, 1, 0) val () = lcd_print (lcd, g_str_atsrun, i2sz 0, length g_str_atsrun) val () = lcd_setCursor (lcd, 0, 1) val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH) val () = delay_ms (MY_DELAY_MS) val () = loop (lcd, str, pos + 1) } } #define MY_DELAY_MS 400.0 #define LCD_WIDTH 16 val g_str_atsrun = "<ATS running!>" val g_str_message = "...Greeting message..." implement main () = { fun loop {n:int}{i:nat | i < n} .<n-i>. (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = if pos + i2sz LCD_WIDTH <= length str then { val () = lcd_setCursor (lcd, 1, 0) val () = lcd_print (lcd, g_str_atsrun, i2sz 0, length g_str_atsrun) val () = lcd_setCursor (lcd, 0, 1) val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH) val () = delay_ms (MY_DELAY_MS) val () = loop (lcd, str, pos + 1) } } #define MY_DELAY_MS 400.0 #define LCD_WIDTH 16 val g_str_atsrun = "<ATS running!>" val g_str_message = "...Greeting message..." implement main () = { fun loop {n:int}{i:nat | i < n} .<n-i>. (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = if pos + i2sz LCD_WIDTH <= length str then { val () = lcd_setCursor (lcd, 1, 0) val () = lcd_print (lcd, g_str_atsrun, i2sz 0, length g_str_atsrun) val () = lcd_setCursor (lcd, 0, 1) val () = lcd_print (lcd, str, pos, i2sz LCD_WIDTH) val () = delay_ms (MY_DELAY_MS) val () = loop (lcd, str, pos + 1) } }
  • 24. Demo code: LCD greetingDemo code: LCD greetingDemo code: LCD greetingDemo code: LCD greetingDemo code: LCD greeting fun forever {n:int}{i:nat | i < n} (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = loop (lcd, str, pos) val () = forever (lcd, str, pos) } val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) val () = forever (lcd, g_str_message, i2sz 0) val () = lcd_close lcd } fun forever {n:int}{i:nat | i < n} (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = loop (lcd, str, pos) val () = forever (lcd, str, pos) } val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) val () = forever (lcd, g_str_message, i2sz 0) val () = lcd_close lcd } fun forever {n:int}{i:nat | i < n} (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = loop (lcd, str, pos) val () = forever (lcd, str, pos) } val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) val () = forever (lcd, g_str_message, i2sz 0) val () = lcd_close lcd } fun forever {n:int}{i:nat | i < n} (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = loop (lcd, str, pos) val () = forever (lcd, str, pos) } val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) val () = forever (lcd, g_str_message, i2sz 0) val () = lcd_close lcd } fun forever {n:int}{i:nat | i < n} (lcd: !lcd_t, str: string (n), pos: size_t (i)): void = { val () = loop (lcd, str, pos) val () = forever (lcd, str, pos) } val lcd = lcd_open (8, 13, 9, 4, 5, 6, 7) val () = forever (lcd, g_str_message, i2sz 0) val () = lcd_close lcd }
  • 25. Binary size efficiencyBinary size efficiencyBinary size efficiencyBinary size efficiencyBinary size efficiency For examples on "Getting Started with Arduino", ATS has good binary size efficiency as well as C. For examples on "Getting Started with Arduino", ATS has good binary size efficiency as well as C. For examples on "Getting Started with Arduino", ATS has good binary size efficiency as well as C. For examples on "Getting Started with Arduino", ATS has good binary size efficiency as well as C. For examples on "Getting Started with Arduino", ATS has good binary size efficiency as well as C.
  • 26. ConclusionConclusionConclusionConclusionConclusion ☆ Can we directly use functional style programming on embedded system? ☆ Can we directly use functional style programming on embedded system? ☆ Can we directly use functional style programming on embedded system? ☆ Can we directly use functional style programming on embedded system? ☆ Can we directly use functional style programming on embedded system? ☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language. ☆ Can we make more safety than C language on embedded system? ☆ Can we make more safety than C language on embedded system? ☆ Can we make more safety than C language on embedded system? ☆ Can we make more safety than C language on embedded system? ☆ Can we make more safety than C language on embedded system? ☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language.☆ ⇒ Yes, with ATS language. https://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-atshttps://github.com/fpiot/arduino-ats
  • 27. License of photos #1License of photos #1License of photos #1License of photos #1License of photos #1 * Minecraft toys | Flickr - Photo Sharing! https://www.flickr.com/photos/sergesegal/15976451410/ Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0 * Arduino Uno | Flickr - Photo Sharing! https://www.flickr.com/photos/snootlab/6052455554/ Copyright: Snootlab / License: CC BY 2.0 * Thank You Dennis Ritchie | Flickr - Photo Sharing! https://www.flickr.com/photos/vincentpants/6239875256/ Copyright: Vincent van Haaff / License: CC BY-SA 2.0 * Climbing Journal Mount Rinjani package | Flickr - Photo Sharing! https://www.flickr.com/photos/trekkingrinjani/4930552641/ Copyright: Trekking Rinjani / License: CC BY 2.0 * Recycling Grunge Sign | Flickr - Photo Sharing! https://www.flickr.com/photos/80497449@N04/8677649972/ Copyright: Nicolas Raymond / License: CC BY 2.0 * IMG_4097 | Flickr - Photo Sharing! https://www.flickr.com/photos/matthewpiatt/1562708158/ Copyright: Matthew Piatt / License: CC BY-SA 2.0 * Seagulls in Flight | Flickr - Photo Sharing! https://www.flickr.com/photos/87007001@N04/13513835453/ Copyright: Shaun Fisher / License: CC BY 2.0 * Minecraft toys | Flickr - Photo Sharing! https://www.flickr.com/photos/sergesegal/15976451410/ Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0 * Arduino Uno | Flickr - Photo Sharing! https://www.flickr.com/photos/snootlab/6052455554/ Copyright: Snootlab / License: CC BY 2.0 * Thank You Dennis Ritchie | Flickr - Photo Sharing! https://www.flickr.com/photos/vincentpants/6239875256/ Copyright: Vincent van Haaff / License: CC BY-SA 2.0 * Climbing Journal Mount Rinjani package | Flickr - Photo Sharing! https://www.flickr.com/photos/trekkingrinjani/4930552641/ Copyright: Trekking Rinjani / License: CC BY 2.0 * Recycling Grunge Sign | Flickr - Photo Sharing! https://www.flickr.com/photos/80497449@N04/8677649972/ Copyright: Nicolas Raymond / License: CC BY 2.0 * IMG_4097 | Flickr - Photo Sharing! https://www.flickr.com/photos/matthewpiatt/1562708158/ Copyright: Matthew Piatt / License: CC BY-SA 2.0 * Seagulls in Flight | Flickr - Photo Sharing! https://www.flickr.com/photos/87007001@N04/13513835453/ Copyright: Shaun Fisher / License: CC BY 2.0 * Minecraft toys | Flickr - Photo Sharing! https://www.flickr.com/photos/sergesegal/15976451410/ Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0 * Arduino Uno | Flickr - Photo Sharing! https://www.flickr.com/photos/snootlab/6052455554/ Copyright: Snootlab / License: CC BY 2.0 * Thank You Dennis Ritchie | Flickr - Photo Sharing! https://www.flickr.com/photos/vincentpants/6239875256/ Copyright: Vincent van Haaff / License: CC BY-SA 2.0 * Climbing Journal Mount Rinjani package | Flickr - Photo Sharing! https://www.flickr.com/photos/trekkingrinjani/4930552641/ Copyright: Trekking Rinjani / License: CC BY 2.0 * Recycling Grunge Sign | Flickr - Photo Sharing! https://www.flickr.com/photos/80497449@N04/8677649972/ Copyright: Nicolas Raymond / License: CC BY 2.0 * IMG_4097 | Flickr - Photo Sharing! https://www.flickr.com/photos/matthewpiatt/1562708158/ Copyright: Matthew Piatt / License: CC BY-SA 2.0 * Seagulls in Flight | Flickr - Photo Sharing! https://www.flickr.com/photos/87007001@N04/13513835453/ Copyright: Shaun Fisher / License: CC BY 2.0 * Minecraft toys | Flickr - Photo Sharing! https://www.flickr.com/photos/sergesegal/15976451410/ Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0 * Arduino Uno | Flickr - Photo Sharing! https://www.flickr.com/photos/snootlab/6052455554/ Copyright: Snootlab / License: CC BY 2.0 * Thank You Dennis Ritchie | Flickr - Photo Sharing! https://www.flickr.com/photos/vincentpants/6239875256/ Copyright: Vincent van Haaff / License: CC BY-SA 2.0 * Climbing Journal Mount Rinjani package | Flickr - Photo Sharing! https://www.flickr.com/photos/trekkingrinjani/4930552641/ Copyright: Trekking Rinjani / License: CC BY 2.0 * Recycling Grunge Sign | Flickr - Photo Sharing! https://www.flickr.com/photos/80497449@N04/8677649972/ Copyright: Nicolas Raymond / License: CC BY 2.0 * IMG_4097 | Flickr - Photo Sharing! https://www.flickr.com/photos/matthewpiatt/1562708158/ Copyright: Matthew Piatt / License: CC BY-SA 2.0 * Seagulls in Flight | Flickr - Photo Sharing! https://www.flickr.com/photos/87007001@N04/13513835453/ Copyright: Shaun Fisher / License: CC BY 2.0 * Minecraft toys | Flickr - Photo Sharing! https://www.flickr.com/photos/sergesegal/15976451410/ Copyright: 2015 Sergey Galyonkin / License: CC BY-SA 2.0 * Arduino Uno | Flickr - Photo Sharing! https://www.flickr.com/photos/snootlab/6052455554/ Copyright: Snootlab / License: CC BY 2.0 * Thank You Dennis Ritchie | Flickr - Photo Sharing! https://www.flickr.com/photos/vincentpants/6239875256/ Copyright: Vincent van Haaff / License: CC BY-SA 2.0 * Climbing Journal Mount Rinjani package | Flickr - Photo Sharing! https://www.flickr.com/photos/trekkingrinjani/4930552641/ Copyright: Trekking Rinjani / License: CC BY 2.0 * Recycling Grunge Sign | Flickr - Photo Sharing! https://www.flickr.com/photos/80497449@N04/8677649972/ Copyright: Nicolas Raymond / License: CC BY 2.0 * IMG_4097 | Flickr - Photo Sharing! https://www.flickr.com/photos/matthewpiatt/1562708158/ Copyright: Matthew Piatt / License: CC BY-SA 2.0 * Seagulls in Flight | Flickr - Photo Sharing! https://www.flickr.com/photos/87007001@N04/13513835453/ Copyright: Shaun Fisher / License: CC BY 2.0
  • 28. License of photos #2License of photos #2License of photos #2License of photos #2License of photos #2 * Arduino Uno unboxing | Flickr - Photo Sharing! https://www.flickr.com/photos/mightyohm/5052594028/ Copyright: Jeff Keyzer / License: CC BY-SA 2.0 * Creative Commons BBB | Flickr - Photo Sharing! https://www.flickr.com/photos/steren/2732488224/ Copyright: Steren Giannini / License: CC BY 2.0 * LED | Flickr - Photo Sharing! https://www.flickr.com/photos/nao904/6084536885/ Copyright: Nao. Fujita / License: CC BY 2.0 * Pagoda's curly steps | Flickr - Photo Sharing! https://www.flickr.com/photos/kewl/6834141860/ Copyright: Tristan Schmurr / License: CC BY 2.0 * Arduino Uno unboxing | Flickr - Photo Sharing! https://www.flickr.com/photos/mightyohm/5052594028/ Copyright: Jeff Keyzer / License: CC BY-SA 2.0 * Creative Commons BBB | Flickr - Photo Sharing! https://www.flickr.com/photos/steren/2732488224/ Copyright: Steren Giannini / License: CC BY 2.0 * LED | Flickr - Photo Sharing! https://www.flickr.com/photos/nao904/6084536885/ Copyright: Nao. Fujita / License: CC BY 2.0 * Pagoda's curly steps | Flickr - Photo Sharing! https://www.flickr.com/photos/kewl/6834141860/ Copyright: Tristan Schmurr / License: CC BY 2.0 * Arduino Uno unboxing | Flickr - Photo Sharing! https://www.flickr.com/photos/mightyohm/5052594028/ Copyright: Jeff Keyzer / License: CC BY-SA 2.0 * Creative Commons BBB | Flickr - Photo Sharing! https://www.flickr.com/photos/steren/2732488224/ Copyright: Steren Giannini / License: CC BY 2.0 * LED | Flickr - Photo Sharing! https://www.flickr.com/photos/nao904/6084536885/ Copyright: Nao. Fujita / License: CC BY 2.0 * Pagoda's curly steps | Flickr - Photo Sharing! https://www.flickr.com/photos/kewl/6834141860/ Copyright: Tristan Schmurr / License: CC BY 2.0 * Arduino Uno unboxing | Flickr - Photo Sharing! https://www.flickr.com/photos/mightyohm/5052594028/ Copyright: Jeff Keyzer / License: CC BY-SA 2.0 * Creative Commons BBB | Flickr - Photo Sharing! https://www.flickr.com/photos/steren/2732488224/ Copyright: Steren Giannini / License: CC BY 2.0 * LED | Flickr - Photo Sharing! https://www.flickr.com/photos/nao904/6084536885/ Copyright: Nao. Fujita / License: CC BY 2.0 * Pagoda's curly steps | Flickr - Photo Sharing! https://www.flickr.com/photos/kewl/6834141860/ Copyright: Tristan Schmurr / License: CC BY 2.0 * Arduino Uno unboxing | Flickr - Photo Sharing! https://www.flickr.com/photos/mightyohm/5052594028/ Copyright: Jeff Keyzer / License: CC BY-SA 2.0 * Creative Commons BBB | Flickr - Photo Sharing! https://www.flickr.com/photos/steren/2732488224/ Copyright: Steren Giannini / License: CC BY 2.0 * LED | Flickr - Photo Sharing! https://www.flickr.com/photos/nao904/6084536885/ Copyright: Nao. Fujita / License: CC BY 2.0 * Pagoda's curly steps | Flickr - Photo Sharing! https://www.flickr.com/photos/kewl/6834141860/ Copyright: Tristan Schmurr / License: CC BY 2.0