-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
1549 lines (1133 loc) · 80.5 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Coconauts]]></title>
<link href="http://coconauts.net/atom.xml" rel="self"/>
<link href="http://coconauts.net/"/>
<updated>2017-06-07T12:17:43+00:00</updated>
<id>http://coconauts.net/</id>
<author>
<name><![CDATA[Coconauts]]></name>
<email><![CDATA[admin@coconauts.net]]></email>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Bank Holiday Hackday: Escape Room on Unity3D]]></title>
<link href="http://coconauts.net/blog/2017/05/29/bank-holiday-hackday-escape-room-on-unity3d/"/>
<updated>2017-05-29T20:00:14+00:00</updated>
<id>http://coconauts.net/blog/2017/05/29/bank-holiday-hackday-escape-room-on-unity3d</id>
<content type="html"><![CDATA[<p>It’s another bank holiday in England, and in Coconauts this means: hackday!</p>
<p>Last time we did an <a href="http://coconauts.net/blog/2017/05/01/infinify-an-infinite-discovery-mode-for-spotify/">infinite recommender for Spotify</a>,
and this time we wanted to get started with a game concept that has been in our heads for a while: <a href="https://en.wikipedia.org/wiki/Escape_room">a escape room</a>.</p>
<p><img src="http://coconauts.net/images/posts/2017-05-29-escape-room/room.png" alt="Room" /></p>
<p>Our idea came after playing the <a href="https://boardgamegeek.com/boardgame/213460/unlock"><em>Unlock!</em> board game</a>,
which quite successfully recreates the experience of a scape room using just cards.
The only downside of the game is that after you’ve solved each of the 3 rooms,
it looses the fun, as you already know the solution to the puzzles. So we though,
wouldn’t it be cool to use this idea on a videogame, and have autogenerated puzzles
so that the fun never ends?</p>
<!-- more-->
<p>Lets not get overexcited though: we set as our first goal to design and implement a
static escape room puzzle, just to get familiar with the concept and the mechanics.
So that was the goal of today’s hackday.</p>
<p>We started by brainstorming some ideas for items and fixtures in a possible
escape room. Then we started linking some of them together as dependencies,
following the <a href="http://grumpygamer.com/puzzle_dependency_charts">puzzle dependency graph technique</a>, that the good people at Lucasarts use to design their adventure games. It’s surprisingly easy to start
doodling puzzles with this method!</p>
<p><img src="http://coconauts.net/images/posts/2017-05-29-escape-room/puzzle_whiteboard.png" alt="Puzzle whiteboarding" /></p>
<p>Then we got into implementing. We went for Unity3D, using fixed camera scenes for
the main room and each of the fixtures that we need to interact with. We
ended up having to dumb down a bit our original puzzle grahp design,
as otherwise we wouldn’t have had time to implement it all in a day.</p>
<p>The end result is a short, but we hope that also clever escape room.
You can play right <a href="http://unity3d.coconauts.net/escaperoom/">here from your browser!</a></p>
<p><a href="http://unity3d.coconauts.net/escaperoom/"><img src="http://coconauts.net/images/posts/2017-05-29-escape-room/door.png"/></a></p>
<p>We are quite happy with the result. It’s the first time we make a puzzler game
and it turns out it is very rewarding: usually physics is the most frustrating
part of game development, and you have none of that in here. Your mind can focus
on designing and thinking puzzles rather than on tricky implementations. And
the game is fun without having to spend a lot of time polishing the mechanics.</p>
<p>As stated, our MVP is linear (except for a couple of passwords which are
generated randomly), but we plan to pick this project again to try to turn
it into something generative next time. Stay tuned!</p>
<p><img src="http://coconauts.net/images/posts/2017-05-29-escape-room/tv.png" alt="TV" /></p>
<p>UPDATE: now <a href="https://play.google.com/store/apps/details?id=net.coconauts.escaperoomhack">also ported to Android!</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Control Energenie With NodeMCU]]></title>
<link href="http://coconauts.net/blog/2017/05/16/control-energenie-with-nodemcu/"/>
<updated>2017-05-16T08:53:19+00:00</updated>
<id>http://coconauts.net/blog/2017/05/16/control-energenie-with-nodemcu</id>
<content type="html"><![CDATA[<p>You might have noticed, we like the concept of Smart Homes, and physical devices you can control remotely from an API using your local Wifi network. Specifically, we’re talking about Energenie sockets, a brand of electrical sockets controlled by radio. We’ve introduced previously these sockets in <a href="http://coconauts.net/blog/tags/energenie/">posts</a> like <a href="http://coconauts.net/blog/2017/03/10/control-energenie-with-esp8266/">Control Energenie with ESP8266</a>, <a href="http://coconauts.net/blog/2017/02/15/control-energenie-with-pebble/">Control energenie with Pebble</a> or <a href="http://coconauts.net/blog/2016/04/15/energinie-and-raspberry-pi-setup/">Raspberry Pi and Energenie</a> but this time, we’re going to show you how we built the same Energenie radio controller with a NodeMCU web server.</p>
<p><img src="http://coconauts.net/images/posts/2017-05-16-energenie-nodemcu/board.jpg" alt="board" /></p>
<!-- more-->
<h2>NodeMCU</h2>
<p>NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module. <a href="https://en.wikipedia.org/wiki/NodeMCU">Source</a></p>
<p>The concept behind this is the same as our <a href="http://coconauts.net/blog/2017/03/10/control-energenie-with-esp8266/">ESP8266</a> implementation. But, there are a few advantages of using NodeMCU instead.</p>
<ul>
<li>Easier development</li>
<li>Lua scripting (easier than C++)</li>
<li>Standard 5V microusb power input</li>
<li>More stability (ESP8266 was constantly restarting (memory leak on C++?))</li>
<li>Easier wiring (No need for reset button or PIN0 hack)</li>
<li>More pins available than our previous <a href="http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family">ESP-01</a> module (this is ESP-12)</li>
<li>Fully dedicated SDK (ESPlorer)</li>
</ul>
<p><img src="http://coconauts.net/images/posts/2017-05-16-energenie-nodemcu/esplorer.png" alt="esplorer" /></p>
<h2>Lua examples on NodeMCU</h2>
<p>Lua scripting is very simple and easy to learn. Similar to python at first, but without the alignment restriction; you use <code>end</code> tags to mark the end of a statement. These are a few examples</p>
<h3>LED blink</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>LED_PIN = 4 -- Use pin 4
</span><span class='line'>gpio.mode(LED_PIN, gpio.OUTPUT)
</span><span class='line'>
</span><span class='line'>while true do
</span><span class='line'> gpio.write(LED_PIN, gpio.HIGH)
</span><span class='line'> tmr.delay(500 * 1000)
</span><span class='line'>
</span><span class='line'> gpio.write(LED_PIN, gpio.LOW)
</span><span class='line'> tmr.delay(500 * 1000)
</span><span class='line'>end</span></code></pre></td></tr></table></div></figure>
<p></p>
<h3>Web server</h3>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>wifi.setmode(wifi.STATION)
</span><span class='line'>wifi.sta.config("Marphus","fafafafafa")
</span><span class='line'>
</span><span class='line'>function check_wifi()
</span><span class='line'> local ip = wifi.sta.getip()
</span><span class='line'>
</span><span class='line'> if(ip==nil) then
</span><span class='line'> print("Connecting...")
</span><span class='line'> else
</span><span class='line'> tmr.stop(0)
</span><span class='line'> print("Connected to AP!")
</span><span class='line'> print(ip)
</span><span class='line'> end
</span><span class='line'>end
</span><span class='line'>tmr.alarm(0,1000,1,check_wifi)
</span><span class='line'>
</span><span class='line'>srv=net.createServer(net.TCP)
</span><span class='line'>srv:listen(80,function(conn)
</span><span class='line'> conn:on("receive", function(client,request)
</span><span class='line'> local buf = "";
</span><span class='line'> local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
</span><span class='line'> if(method == nil)then
</span><span class='line'> _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
</span><span class='line'> end
</span><span class='line'> -- Store all the GET parameters in a table
</span><span class='line'> local _GET = {}
</span><span class='line'> if (vars ~= nil)then
</span><span class='line'> for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
</span><span class='line'> _GET[k] = v
</span><span class='line'> end
</span><span class='line'> end
</span><span class='line'>
</span><span class='line'> buf = buf.."<h1> ESP8266 Web Server</h1>";
</span><span class='line'>
</span><span class='line'> client:send(buf);
</span><span class='line'> client:close();
</span><span class='line'> collectgarbage();
</span><span class='line'> end)
</span><span class='line'>end)</span></code></pre></td></tr></table></div></figure>
<p>More examples are available on their <a href="http://nodemcu.com/index_en.html">official website</a></p>
<h2>Control radio energenie via web server</h2>
<p>In this script we will combine the previous web server with a simple function to send radio signals.</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
<span class='line-number'>44</span>
<span class='line-number'>45</span>
<span class='line-number'>46</span>
<span class='line-number'>47</span>
<span class='line-number'>48</span>
<span class='line-number'>49</span>
<span class='line-number'>50</span>
<span class='line-number'>51</span>
<span class='line-number'>52</span>
<span class='line-number'>53</span>
<span class='line-number'>54</span>
<span class='line-number'>55</span>
<span class='line-number'>56</span>
<span class='line-number'>57</span>
<span class='line-number'>58</span>
<span class='line-number'>59</span>
<span class='line-number'>60</span>
<span class='line-number'>61</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>wifi.setmode(wifi.STATION)
</span><span class='line'>wifi.sta.config("SSID","password")
</span><span class='line'>
</span><span class='line'>function check_wifi()
</span><span class='line'> local ip = wifi.sta.getip()
</span><span class='line'>
</span><span class='line'> if(ip==nil) then
</span><span class='line'> print("Connecting...")
</span><span class='line'> else
</span><span class='line'> tmr.stop(0)
</span><span class='line'> print("Connected to AP!")
</span><span class='line'> print(ip)
</span><span class='line'> end
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'>tmr.alarm(0,1000,1,check_wifi)
</span><span class='line'>
</span><span class='line'>RADIO_PIN = 4
</span><span class='line'>gpio.mode(RADIO_PIN, gpio.OUTPUT)
</span><span class='line'>
</span><span class='line'>function sendCode(code)
</span><span class='line'> print("Sending radio code " .. code)
</span><span class='line'> rc.send(RADIO_PIN,code,24,185,1,2) --Sends the data via GPIO pin 4 to the rc switch.
</span><span class='line'>end
</span><span class='line'>
</span><span class='line'>srv=net.createServer(net.TCP)
</span><span class='line'>srv:listen(80,function(conn)
</span><span class='line'> conn:on("receive", function(client,request)
</span><span class='line'> local buf = "";
</span><span class='line'> local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
</span><span class='line'> if(method == nil)then
</span><span class='line'> _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
</span><span class='line'> end
</span><span class='line'> local _GET = {}
</span><span class='line'> if (vars ~= nil)then
</span><span class='line'> for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
</span><span class='line'> _GET[k] = v
</span><span class='line'> print("Got parameter " .. k .. ": " .. v)
</span><span class='line'> end
</span><span class='line'> end
</span><span class='line'> buf = buf.."<h1> ESP8266 Radio Web Server</h1>";
</span><span class='line'> local radiofreq = {
</span><span class='line'> ["Socket 1"] = {on= 6916877, off= 6916878},
</span><span class='line'> ["Socket 2"] = {on= 6916871, off= 6916870},
</span><span class='line'> ["Socket 3"] = {on= 6916875, off= 6916874},
</span><span class='line'> ["Socket 4"] = {on= 6916867, off= 6916866}
</span><span class='line'> }
</span><span class='line'> for k, v in pairs(radiofreq) do
</span><span class='line'> buf = buf.."<p>" .. k .. "<a href=\"?f=" ..v["on"] .."\"><button>ON</button></a> <a href=\"?f="..v["off"].."\"><button>OFF</button></a></p>";
</span><span class='line'> end
</span><span class='line'>
</span><span class='line'> local _on,_off = "",""
</span><span class='line'>
</span><span class='line'> if( _GET.f ~= nil)then
</span><span class='line'> sendCode(_GET.f)
</span><span class='line'> end
</span><span class='line'> client:send(buf);
</span><span class='line'> client:close();
</span><span class='line'> collectgarbage();
</span><span class='line'> end)
</span><span class='line'>end)
</span></code></pre></td></tr></table></div></figure>
<p><img src="http://coconauts.net/images/posts/2017-05-16-energenie-nodemcu/server.png" alt="server" /></p>
<p>Again, as always, our code and all the details about this project are available on <a href="https://github.com/rephus/nodemcu-radio">Github</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Infinify: An Infinite Discovery Mode for Spotify]]></title>
<link href="http://coconauts.net/blog/2017/05/01/infinify-an-infinite-discovery-mode-for-spotify/"/>
<updated>2017-05-01T18:13:37+00:00</updated>
<id>http://coconauts.net/blog/2017/05/01/infinify-an-infinite-discovery-mode-for-spotify</id>
<content type="html"><![CDATA[<p>I’m a Spotify user. I’m not the greatest fan of the user experience they offer, but it’s definitely the “lesser evil” when it comes to music streaming.</p>
<p>You see, I’m the kind of person that just cant be bothered to choose, I <em>loathe</em>
choosing. Deciding albums to hear? What are we, in the 90s? with phisical CDs that
need popping into a player? It’s the digital age! I just want to open Spotify
and be presented with a continuous stream of non-stop music,
wihout having the choose an album, or a genre, or a playlist.
They even require my constant feedback when in radio mode!
(don’t even get me started on the Spotify radio, <em>yuck</em>).
I just want a big “play” button and let Spotify use a teeny bit of
machine intelligence to feed me stuff that it thinks I might like.
Considering the app is sitting on top of a pile of data from me
(listening history, saved collection)… is it really that hard?</p>
<p>Because Spotify is not giving that to me though, we at Coconauts decided to
build it ourselves, using their API and Javascript. The result: Infinify.</p>
<p><img src="http://coconauts.net/images/posts/2017-05-01-infinify/infinify.png" alt="Infinify" /></p>
<!-- more-->
<h2>What is it?</h2>
<p>Infinify is a website with a huge “play” button, that feeds on your
Spotify saved collection to produce a continuous mix of tracks from your
own music plus recommendations.</p>
<h2>How does it work?</h2>
<p>Spotify exposes <a href="https://developer.spotify.com/web-api/get-recommendations/">a very powerful <code>/recommendations</code> endpoint on their API</a>,
which I reckon plugs into <a href="https://qz.com/571007/the-magic-that-makes-spotifys-discover-weekly-playlists-so-damn-good/">the same magic that is powering their discovery modes</a>.</p>
<p>The <code>/recommendations</code> endpoint instantly gives you a list of recommended tracks,
given a seed of a list of songs, artists or genres. You can even tune a bunch of
crazy parameters, such as <em>danceability</em>, <em>energy</em> or <em>popularity</em>. It’s quite amazing.</p>
<p>The problem though is that the recommendations output is finite (capped at 100 results),
whereas we want a continuous flow of recommendations.</p>
<p>Another problem with it, which is also noticiable in their discovery modes,
is that it tries too hard to give you music that is similar to <em>all</em> of your seeds.
Wha this means is: if you seed it with some classical music, heavy metal and jazz,
it’s going to try to return tracks that are strange chimaeras mixing all of those
traits, rather than giving you a mixed bag of more conventional tracks in those genres.
In other words: it’s an <em>and</em>, not an <em>or</em>. Now, this might actually be what you want
in some occasions, but when it comes to recommending music to people it doesn’t work:
if I like John Williams and Queen I want to be recommended Danny Elfman and Van Halen,
not “Some Orchestra Plays Very Bland Rock Classics”.</p>
<p><img src="http://coconauts.net/images/posts/2017-05-01-infinify/epicrock.png" alt="Infinify" /></p>
<p>So our solution involves working around the endpoint, using in a bit unorthodox way:</p>
<ol>
<li>Fetch a random single song from the user’s saved music collection.</li>
<li>Use this song’s artist as a seed to the <code>/recommendations</code> endpoint. Get a small X number of songs back.</li>
<li>Pick a random song from the response, and add it to a playlist.</li>
<li>Repeat the above every 2 minutes.</li>
</ol>
<p>In this fashion, the result is a Spotify playlist that is continuously growing
with fresh recommendations (for as long as the the website remains open).</p>
<p>We use the artist as a seed, rather than the song, so that you can still get
a chance of getting the songs you already have in your library and love.</p>
<p>The seed is started from a single song to try to get purer recommendations, rather
than strange blends. We then produce X recommendations and pick one. Why?
Well, we experienced that the first item in the results is always a song by the
same artist that your seed, and this doesn’t give you much variety. So by producing
several and then picking one of them, you get a delicious balance: you’ll get a
certain chance to get songs by the same artists in your library, but them a slightly
bigger chance to get related artists (that may or not be in your library).</p>
<p>This X number of tracks is what we call the <em>discoverability</em> parameter, and
you can toggle it between 1 (“I just want the artists I know and love”) and 10
(in which approximately 9 in every 10 songs will be new, and 1 will be familiar).</p>
<p><img src="http://coconauts.net/images/posts/2017-05-01-infinify/discoverability.png" alt="Infinify" /></p>
<h2>The ugly bits</h2>
<p>Unfortunately there are some limitations that make the user experience a bit rough.
For starters, the fact that you need to have an external web application to start
the infinfy playlist. Spotify <a href="https://developer.spotify.com/technologies/apps/">scrapped their in-app extensions</a> some years ago,
so the only way to add integration nowdays is by keeping them completely external.</p>
<p>It would be possible to stream the audio directly to the webapp, but only 30-second
samples: not acceptable. So you need Spotify for playback, and the webapp for the
integration.</p>
<p>You can at least <a href="https://developer.spotify.com/web-api/start-a-users-playback/">control the playback on a device via the API</a>, you need to
have a premium account for that. So if you don’t, you need to hit the play button
twice: once on infinify, once on the app.</p>
<p>Another uglyness is that we found no way via the API to be able to track the
listening progress of the user on the playlist. This made it quite difficult to
determine when we should add and remove tracks from the playlist.
After trying some nasty kludges, we decided for a straigghtforward solution:
just add new songs every 2 minutes, and keep the old ones there. They don’t
bother you after all! (in fact, its kinda nice to have a record of your
listening session) and there’s no problem on Spotify even if the playlist
gets absurdly long.</p>
<p>The only edge case is if you run out of songs in the
playlist: for this eventuality we added a little <code>(+)</code> button to force a manual
generation. When you start a new session the playlist gets reset, as it would be
confusing to have the long list of tracks from last time.</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/_ge4n9zmTRQ" frameborder="0" allowfullscreen></iframe>
<p>Because the way we are abusing the <code>/recommendations</code> endpoint, ours is
not the most rate-friendly solution. However, it’s also not that bad: our load
is 4 or 5 requests every 2 minutes, which still falls within reasonable limits,
at least if we keep it to only one user.</p>
<h2>Final remarks</h2>
<p>For recommender engines, and in general many AI problems, there’s usually
a rule: a naive, straightforward solution can take you 60-80% there.
Then any increases on that number will require years of PhD research.</p>
<p>Infinify is a very simple solution, but surprisingly, also very effective! I was
very pleased with the quality of recommendations, and how you can still get
a mix of familiar and new. Of course, most of the
heavy lifting comes from the magic behind the <code>/recommendations</code> engine,
but I’m happy that we could bend it to overcome it’s limitations.</p>
<p>For now, I intend to use it heavily for a while and see if it still satisfy me,
or if recommendations start getting a bit repetitive. In such case, I might start
tunning the algorithim to try more variability (for instance, going for
multi-level recommendations from recommendations).</p>
<p>You can get the code for Infinify <a href="https://github.com/coconauts/infinify">on Github</a>.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Water Ring Simulator]]></title>
<link href="http://coconauts.net/blog/2017/03/27/water-rings-simulator/"/>
<updated>2017-03-27T10:12:19+00:00</updated>
<id>http://coconauts.net/blog/2017/03/27/water-rings-simulator</id>
<content type="html"><![CDATA[<p>We have more projects that posts in the blog, that’s why a long ago we created a new new version of our first-game-ever: Water Rings.</p>
<iframe width="560" height="560" src="https://www.youtube.com/embed/5VBlgFSvP_w" frameborder="0" allowfullscreen></iframe>
<!--more-->
<p>Water Rings Simulator is the new version of the classic toy game on Unity3d exlusive for Android.</p>
<p>This game features:</p>
<ul>
<li>Realisitc underwater physics</li>
<li>3D graphics</li>
<li>Mobile movement detection</li>
<li>Realistic visual effects</li>
<li>Transparent phone background (using camera to see behind it)</li>
<li>It’s FREE!</li>
</ul>
<p><img src="http://coconauts.net/images/posts/2017-04-20-water-rings-simulator/transparent.png" alt="game screenshot" /></p>
<p>Download the game for free on the <a href="https://play.google.com/store/apps/details?id=net.coconauts.water3d">Android Play Store</a></p>
<p>Do you want us to keep expanding the game? let us know in the comments</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Github PR Tracker]]></title>
<link href="http://coconauts.net/blog/2017/03/27/github-pr-tracker/"/>
<updated>2017-03-27T10:12:19+00:00</updated>
<id>http://coconauts.net/blog/2017/03/27/github-pr-tracker</id>
<content type="html"><![CDATA[<p>Sometimes I feel like following changes on PRs on Github is a bit confusing and/or verbose, even with the existing <a href="https://github.com/notifications">Github notifications</a>
or <a href="https://github.com/pulls">Github pulls</a> interfaces, sometimes the best way was to check your email inbox.</p>
<p>So I decided to create my own <a href="https://github.com/rephus/Github-PR-tracker">Github PR tracker</a>
for my own Pull Requests, but also for those that I’m assigned to.</p>
<p><img src="http://coconauts.net/images/posts/2017-03-27-github-pr-tracker/screen.png" alt="github pr tracker" /></p>
<!-- more-->
<h2>Features</h2>
<ul>
<li><p>Group pull requests by title, that will allow me to easily visualize changes related between microservices (in different github repos)</p></li>
<li><p>Visual “Red dot” on those Pull requests that have been updated since you refreshed the page:
comment added, commit made, opened pull request…</p></li>
<li><p>Get quick access to all your relevant PRs, only pin this page on your browser,
and forget about dozens of opened tabs or bookmarks.</p></li>
</ul>
<h2>How to use</h2>
<p>First pull the repo from <a href="https://github.com/rephus/Github-PR-tracker">here</a>.</p>
<p>Then you need to create a
<a href="https://github.com/settings/tokens">Github personal access token</a>
and use it on the input text on the search (or modify the index.html to add the default value)</p>
<p>Easy and simple.</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Control Energenie With ESP8266]]></title>
<link href="http://coconauts.net/blog/2017/03/10/control-energenie-with-esp8266/"/>
<updated>2017-03-10T21:30:19+00:00</updated>
<id>http://coconauts.net/blog/2017/03/10/control-energenie-with-esp8266</id>
<content type="html"><![CDATA[<p>We recently showed you how to control <a href="http://coconauts.net/blog/2017/02/15/control-energenie-with-pebble/">Energenie sockets using Pebble smartwatch app</a>,
thanks to a <a href="http://coconauts.net/blog/2016/04/15/energinie-and-raspberry-pi-setup/">Raspberry PI</a> REST API.</p>
<p>But we recently found this <a href="https://github.com/cjdell/esp-rf-switch">Github repo</a>
about how to use a generic 433Mhz radio module with an ESP8266 to control Energenie sockets.</p>
<!--more-->
<p>So we decided to replace our Raspberry setup with this cheaper, smaller, portable and scalabe solution.</p>
<p>All you need is an ESP8266 and this tiny and cheap radio module</p>
<p><img src="http://coconauts.net/images/posts/2017-02-16-control-energenie-esp8266/radio-transmitter.png" alt="radio-transmitter" /></p>
<p>In order to build this</p>
<p><img src="http://coconauts.net/images/posts/2017-02-16-control-energenie-esp8266/hardware.png" alt="hardware" /></p>
<p>The detailed guide and schemas about how to do it is on our <a href="https://github.com/rephus/esp8266-energenie-switch">own Github repo</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Smart Staircase LED Lighting With Arduino and IR Sensors]]></title>
<link href="http://coconauts.net/blog/2017/02/21/stair-lights/"/>
<updated>2017-02-21T20:52:19+00:00</updated>
<id>http://coconauts.net/blog/2017/02/21/stair-lights</id>
<content type="html"><![CDATA[<p>For a long time, we’ve been turning on the lights at the beginning the staircase,
just to turn them off when we reach another floor.</p>
<p>But instead, we built a simple system to turn them ON automatically when you are going upstairs or downstairs,
just by using a couple of IR proximity sensors, a relay and an Arduino Pro Mini, to control the timing.</p>
<p>Featured on <a href="https://www.instructables.com/id/Smart-Staircase-LED-Lighting/">Instructables</a> !!</p>
<!--more-->
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Smart staircase LED lighting with <a href="https://twitter.com/hashtag/Arduino?src=hash">#Arduino</a> and IR sensors <a href="https://t.co/ns5zh2r8tQ">pic.twitter.com/ns5zh2r8tQ</a></p>— Javi Rengel (@rephus) <a href="https://twitter.com/rephus/status/830460205699854336">February 11, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>If you want to build your own, just follow our guide.</p>
<h2>Shopping list</h2>
<ul>
<li><a href="https://www.aliexpress.com/item/Smart-car-robot-E18-D80NK-infrared-obstacle-avoidance-sensor-proximity-switch-3-80cm-adjustable-Free-Shipping/32396659854.html">IR proximity sensor</a></li>
<li><a href="https://www.aliexpress.com/item/Free-Shipping-new-version-2pcs-lot-Pro-Mini-328-Mini-ATMEGA328-5V-16MHz-for-Arduino/1731218090.html">Arduino Pro Mini</a></li>
<li><a href="https://www.aliexpress.com/item/1pc-1-Channel-5V-Optocoupler-Driver-Relay-Module-High-Level-for-Arduino-top-quality/32638202870.html">Relay</a></li>
<li><a href="https://www.aliexpress.com/item/Free-Shipping-SMD5050-12V-flexible-light-60-leds-m-LED-strips-5m-lot-White-Blue-Green/1599651146.html">5m LED strip</a></li>
</ul>
<p>You can optionally use a power converter (from 12v to 5v) if you want to take advantage of the 12v input to power your Arduino and sensors.</p>
<ul>
<li><a href="https://www.aliexpress.com/item/1Pc-DC-to-DC-12V-to-5V-3A-15W-Auto-Car-Power-Converter-Regulator-Adapter-for/32702720703.html">12v to 5v converter</a></li>
</ul>
<h2>Schema</h2>
<p><img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/schema.png" alt="schema" /></p>
<h2>Arduino code</h2>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>#define IR_RECEIVER 8
</span><span class='line'>#define RELAY 10
</span><span class='line'>
</span><span class='line'>void setup() {
</span><span class='line'> // initialize digital pin LED_BUILTIN as an output.
</span><span class='line'> pinMode(RELAY, OUTPUT);
</span><span class='line'> digitalWrite(RELAY, LOW);
</span><span class='line'>
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>// the loop function runs over and over again forever
</span><span class='line'>void loop() {
</span><span class='line'>
</span><span class='line'> int sensorValue = digitalRead(IR_RECEIVER);
</span><span class='line'> // print out the value you read:
</span><span class='line'> delay(10); // delay in between reads for stability
</span><span class='line'>
</span><span class='line'> if (sensorValue == 0 ) {
</span><span class='line'> digitalWrite(RELAY, HIGH); // turn the LED on (HIGH is the voltage level)
</span><span class='line'> delay(5000);
</span><span class='line'> }
</span><span class='line'> else {
</span><span class='line'> digitalWrite(RELAY, LOW);
</span><span class='line'>
</span><span class='line'> }
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
<h2>Images</h2>
<p><img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/arduino.jpg" alt="arduino" />
<img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/upstairs.jpg" alt="upstairs" />
<img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/downstairs.jpg" alt="downstairs" /></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Coconauts Podcast S1E1 (en Español)]]></title>
<link href="http://coconauts.net/blog/2017/02/19/coconauts-podcast-e1s1-en-espanol/"/>
<updated>2017-02-19T20:00:14+00:00</updated>
<id>http://coconauts.net/blog/2017/02/19/coconauts-podcast-e1s1-en-espanol</id>
<content type="html"><![CDATA[<p>Note: today’s post is about our podcast in spanish.
But don’t worry, we’ll be back to english on the next post!</p>
<p>¡Ya está aqui la segunda entrega de nuestro podcast!</p>
<iframe id='audio_17098008' frameborder='0' allowfullscreen='' scrolling='no' height='200' style='border:1px solid #EEE; box-sizing:border-box; width:100%;' src="https://www.ivoox.com/player_ej_17098008_4_1.html?c1=ff6600"></iframe>
<p>En este episodio hablamos de:</p>
<ul>
<li>Noticias: el outage de Gitlab, Steam cierra Greenlight, RethinkDB y Cloud Spanner, Gameband.</li>
<li>Yo he venido aquí a hablar de mi libro: la psicología de los objetos cotidianos de Don Norman</li>
<li>Debate: frameworks de desarrollo de videojuegos</li>
</ul>
<!--more-->
<p>Enlaces relacionados:</p>
<ul>
<li><a href="https://about.gitlab.com/2017/02/10/postmortem-of-database-outage-of-january-31/">Gitlab outage postmortem</a></li>
<li><a href="http://steamcommunity.com/greenlight/discussions/18446744073709551615/133256758580075301/">Steam greenlight</a></li>
<li><a href="https://rethinkdb.com/blog/rethinkdb-joins-linux-foundation/">RethinkDB</a></li>
<li><a href="https://cloudplatform.googleblog.com/2017/02/introducing-Cloud-Spanner-a-global-database-service-for-mission-critical-applications.html">Google Cloud Spanner</a></li>
<li><a href="https://www.kickstarter.com/projects/gameband/gameband-the-first-smartwatch-for-gamers?ref=category_newest">Gameband</a></li>
<li><a href="https://www.youtube.com/watch?v=CtgR1YiwnEY">Watchduino</a></li>
<li><a href="https://www.amazon.es/psicolog%C3%ADa-objetos-cotidianos-Serie-Media/dp/8415042019">La psicologia de los objetos cotidianos</a></li>
<li><a href="http://coconauts.net/blog/2017/01/09/2d-game-framework-comparison/">Comparativa de game frameworks</a></li>
</ul>
<p>Música de <a href="http://jukedeck.com">http://jukedeck.com</a></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[RPS: A Phaser.io Simple RTS]]></title>
<link href="http://coconauts.net/blog/2017/02/18/rps-a-phaser-io-simple-rts/"/>
<updated>2017-02-18T11:57:19+00:00</updated>
<id>http://coconauts.net/blog/2017/02/18/rps-a-phaser-io-simple-rts</id>
<content type="html"><![CDATA[<p>If you follow <a href="http://twitter.com/rephus">me</a> or <a href="http://twitter.com/coconauts">Coconauts</a> on Twitter, you might have seen some
GIFs about an RTS game we’re developing on Phaser.io.</p>
<p>Codename: RPS (Rock, Paper, Scissors). Is a simple RTS (Real Strategy Game)
we’re building using the Phaser.io framework for HTML5 games.</p>
<p>We aim to have a fun and complete game, with campaign, multiplayer
and with a fresh interface, compatible with mobile and touch devices.</p>
<p>The main selling point are its simple but effective mechanics.
Forget about hundreds of different units with their own powerups, multiple buildings,
or advanced research.</p>
<!--more-->
<p>This is some of the recent progress we’ve made in the last 2-3 weeks.</p>
<ul>
<li>Minimap</li>
</ul>
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Added a Minimap (bottom-rigth) to our game. It was easier than I expected <a href="https://twitter.com/hashtag/gamedev?src=hash">#gamedev</a> <a href="https://twitter.com/hashtag/phaserIo?src=hash">#phaserIo</a> <a href="https://t.co/A0ATvb5ZxM">pic.twitter.com/A0ATvb5ZxM</a></p>— Coconauts (@coconauts) <a href="https://twitter.com/coconauts/status/826728173996015616">February 1, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<ul>
<li>Simple AI, sight area, and new map</li>
</ul>
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Big progress on our RTS game in <a href="https://twitter.com/hashtag/phaserio?src=hash">#phaserio</a>: simple AI, sight area, new map and more! <a href="https://twitter.com/hashtag/gamedev?src=hash">#gamedev</a> <a href="https://t.co/jnxwofvm5c">pic.twitter.com/jnxwofvm5c</a></p>— Coconauts (@coconauts) <a href="https://twitter.com/coconauts/status/826161939478872069">January 30, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<ul>
<li>Emojis dialogs</li>
</ul>
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Express yourself with in-game emojis <a href="https://twitter.com/hashtag/gamedev?src=hash">#gamedev</a> <a href="https://t.co/l6RoYpmrrm">pic.twitter.com/l6RoYpmrrm</a></p>— Javi Rengel (@rephus) <a href="https://twitter.com/rephus/status/825682597170786304">January 29, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>If you want to follow these updates closely, checkout our <a href="http://coconauts.net/projects/rps">Project page</a></p>
<p>And let us know if you want to give us feedback about how to improve the game !</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Smart Staircase LED Lighting With Arduino and IR Sensors]]></title>
<link href="http://coconauts.net/blog/2017/02/18/stair-lights/"/>
<updated>2017-02-18T10:42:19+00:00</updated>
<id>http://coconauts.net/blog/2017/02/18/stair-lights</id>
<content type="html"><![CDATA[<p>For a long time, we’ve been turning on the lights at the beginning the staircase,
just to turn them off when we reach another floor.</p>
<p>But instead, we built a simple system to turn them ON automatically when you are going upstairs or downstairs,
just by using a couple of IR proximity sensors, a relay and an Arduino Pro Mini, to control the timing.</p>
<!--more-->
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Smart staircase LED lighting with <a href="https://twitter.com/hashtag/Arduino?src=hash">#Arduino</a> and IR sensors <a href="https://t.co/ns5zh2r8tQ">pic.twitter.com/ns5zh2r8tQ</a></p>— Javi Rengel (@rephus) <a href="https://twitter.com/rephus/status/830460205699854336">February 11, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>If you want to build your own, just follow our guide.</p>
<h2>Shopping list</h2>
<ul>
<li><a href="https://www.aliexpress.com/item/Smart-car-robot-E18-D80NK-infrared-obstacle-avoidance-sensor-proximity-switch-3-80cm-adjustable-Free-Shipping/32396659854.html">IR proximity sensor</a></li>
<li><a href="https://www.aliexpress.com/item/Free-Shipping-new-version-2pcs-lot-Pro-Mini-328-Mini-ATMEGA328-5V-16MHz-for-Arduino/1731218090.html">Arduino Pro Mini</a></li>
<li><a href="https://www.aliexpress.com/item/1pc-1-Channel-5V-Optocoupler-Driver-Relay-Module-High-Level-for-Arduino-top-quality/32638202870.html">Relay</a></li>
<li><a href="https://www.aliexpress.com/item/Free-Shipping-SMD5050-12V-flexible-light-60-leds-m-LED-strips-5m-lot-White-Blue-Green/1599651146.html">5m LED strip</a></li>
</ul>
<p>You can optionally use a power converter (from 12v to 5v) if you want to take advantage of the 12v input to power your Arduino and sensors.</p>
<ul>
<li><a href="https://www.aliexpress.com/item/1Pc-DC-to-DC-12V-to-5V-3A-15W-Auto-Car-Power-Converter-Regulator-Adapter-for/32702720703.html">12v to 5v converter</a></li>
</ul>
<h2>Schema</h2>
<p><img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/schema.png" alt="schema" /></p>
<h2>Arduino code</h2>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>#define IR_RECEIVER 8
</span><span class='line'>#define RELAY 10
</span><span class='line'>
</span><span class='line'>void setup() {
</span><span class='line'> // initialize digital pin LED_BUILTIN as an output.
</span><span class='line'> pinMode(RELAY, OUTPUT);
</span><span class='line'> digitalWrite(RELAY, LOW);
</span><span class='line'>
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>// the loop function runs over and over again forever
</span><span class='line'>void loop() {
</span><span class='line'>
</span><span class='line'> int sensorValue = digitalRead(IR_RECEIVER);
</span><span class='line'> // print out the value you read:
</span><span class='line'> delay(10); // delay in between reads for stability
</span><span class='line'>
</span><span class='line'> if (sensorValue == 0 ) {
</span><span class='line'> digitalWrite(RELAY, HIGH); // turn the LED on (HIGH is the voltage level)
</span><span class='line'> delay(5000);
</span><span class='line'> }
</span><span class='line'> else {
</span><span class='line'> digitalWrite(RELAY, LOW);
</span><span class='line'>
</span><span class='line'> }
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
<h2>Images</h2>
<p><img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/arduino.jpg" alt="arduino" />
<img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/upstairs.jpg" alt="upstairs" />
<img src="http://coconauts.net/images/posts/2017-02-18-stair-lights/downstairs.jpg" alt="downstairs" /></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Control Energenie With Pebble]]></title>
<link href="http://coconauts.net/blog/2017/02/15/control-energenie-with-pebble/"/>
<updated>2017-02-15T10:42:19+00:00</updated>
<id>http://coconauts.net/blog/2017/02/15/control-energenie-with-pebble</id>
<content type="html"><![CDATA[<p>Last year I got a cheap Pebble smartwatch
<a href="https://twitter.com/rephus/status/806522854699372546">just days before the company was sold to Fitbit</a></p>
<p>One of the reasons was to play with it building our custom apps,
so we built an app to control our Energenie sockets from the watch,
sending HTTP requests to a Raspberry PI with the official radio module from Energenie.</p>
<p>All you need, apart form the pebble is a Raspberry PI to send the radio signal from a REST API to a Energenie socket.
Check how to do it <a href="http://coconauts.net/blog/2016/04/15/energinie-and-raspberry-pi-setup/">on our previous post</a>.</p>
<p>You can see it in action <a href="https://twitter.com/rephus/status/810630836697649152">here</a>.</p>
<!--more-->
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr">Turning on Christmas from my pebble watch app and energenie sockets. <a href="https://t.co/XvtuQGs6h0">pic.twitter.com/XvtuQGs6h0</a></p>— Javi Rengel (@rephus) <a href="https://twitter.com/rephus/status/810630836697649152">December 18, 2016</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>The source code is availabe on <a href="https://github.com/rephus/pebble-energenie">this repo</a></p>
<p>We might try to build a game using the gyroscope in the future,
do you have any other ideas?</p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Coconauts Podcast Pilot (en Español)]]></title>
<link href="http://coconauts.net/blog/2017/02/07/coconauts-podcast-pilot/"/>
<updated>2017-02-07T20:37:11+00:00</updated>
<id>http://coconauts.net/blog/2017/02/07/coconauts-podcast-pilot</id>
<content type="html"><![CDATA[<p>Note: today’s post is about a podcast we’ve started in spanish.
But don’t worry, we’ll be back to english on the next post!</p>
<p>Con ustedes, ¡el episodio piloto del podcast de Coconauts!</p>
<iframe id='audio_16881889' frameborder='0' allowfullscreen='' scrolling='no' height='200' style='border:1px solid #EEE; box-sizing:border-box; width:100%;' src="https://gb.ivoox.com/es/player_ej_16881889_4_1.html?c1=ff6600"></iframe>
<p>Ultimamente, dado que vamos al trabajo en un trayecto largo en tren, nos hemos
enganchado a escuchar podcasts (mayormente de videojuegos). Sin embargo,
no hemos encontrado ningun podcast de tecnologia o desarrollo en español
que nos guste, así que nos hemos planteado ¿por qué no intentar llenar el hueco?</p>
<!--more-->
<p>Nuestro plan con el podcast es un poco tratar los mismos temas que en el blog
(desarrollo software, hardware y de juegos) con una serie de seciones
mas o menos fijas.</p>
<p>En este episodio piloto hablamos de:</p>
<ul>
<li>Noticias: Zenimax vs Oculus, Asus Tinkerboard, Libretaxi y cancelacion de Scalebound.</li>
<li>Yo he venido aqui a hablar de mi libro: Masters of Doom</li>
<li>Debate: creatividad computacional</li>
</ul>
<p>¡Esperamos que lo disfruteis! No dudeis en dejarnos comentarios aqui mismo,
en nuestro email, o en nuestra cuenta de twitter <a href="https://twitter.com/coconauts">@coconauts</a>.</p>