Skip to content

Commit

Permalink
fixed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cparrapa committed Jul 27, 2021
1 parent 99d3225 commit d8698ce
Show file tree
Hide file tree
Showing 47 changed files with 1,395 additions and 2,968 deletions.
4 changes: 2 additions & 2 deletions www/blocs&generateurs/actionneur.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ Blockly.Python["notone"]=function(block){
Blockly.Blocks["lp2i_mp3_init"]={init:function(){
var card=window.localStorage.card;
this.appendDummyInput().appendField(new Blockly.FieldImage('media/dfplayer.png', 33, 33, "*")).appendField("DFMini Pins")
this.appendDummyInput() .appendField(Blockly.Msg.MP3OS_TX).appendField(new Blockly.FieldDropdown(profile[card].dropdownPWM), "PIN_TX");
this.appendDummyInput() .appendField(Blockly.Msg.MP3OS_RX).appendField(new Blockly.FieldDropdown(profile[card].dropdownPWM), "PIN_RX");
this.appendDummyInput() .appendField(Blockly.Msg.MP3OS_TX).appendField(new Blockly.FieldDropdown(profile[card].dropdownAllPins), "PIN_TX");
this.appendDummyInput() .appendField(Blockly.Msg.MP3OS_RX).appendField(new Blockly.FieldDropdown(profile[card].dropdownAllPins), "PIN_RX");
this.appendValueInput("Volume", "Number").setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.lp2i_mp3_Volume);
this.appendDummyInput().setAlign(Blockly.ALIGN_RIGHT).appendField(Blockly.Msg.lp2i_mp3_autoplay).appendField(new Blockly.FieldCheckbox("FALSE"), "play");
this.setInputsInline(true);
Expand Down
42 changes: 30 additions & 12 deletions www/blocs&generateurs/ottoesp.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ Blockly.Arduino['otto_home'] = function(block) {
};

Blockly.Blocks['otto_calibration']={init:function(){
this.appendDummyInput() .appendField(Blockly.Msg.OTTO9_CALIBRATION + Blockly.Msg.OTTO9_CALIBRATION_LEG + Blockly.Msg.left)
.appendField(new Blockly.FieldNumber("0"), "LL") .appendField(Blockly.Msg.right) .appendField(new Blockly.FieldNumber("0"), "RL")
this.appendDummyInput() .setAlign(Blockly.ALIGN_RIGHT) .appendField(Blockly.Msg.OTTO9_CALIBRATION_FOOT+ Blockly.Msg.left)
.appendField(new Blockly.FieldNumber("0"), "LF") .appendField(Blockly.Msg.right).appendField(new Blockly.FieldNumber("0"), "RF");
this.setInputsInline(false);

this.appendValueInput("LL") .setCheck("Number").appendField(Blockly.Msg.OTTO9_CALIBRATION + Blockly.Msg.OTTO9_CALIBRATION_LEG + Blockly.Msg.left).setAlign(Blockly.ALIGN_RIGHT)
this.appendValueInput("RL") .setCheck("Number").appendField(Blockly.Msg.right) .setAlign(Blockly.ALIGN_RIGHT)
this.appendValueInput("LF") .setCheck("Number").appendField(Blockly.Msg.OTTO9_CALIBRATION_FOOT+ Blockly.Msg.left).setAlign(Blockly.ALIGN_RIGHT)
this.appendValueInput("RF") .setCheck("Number").appendField(Blockly.Msg.right).setAlign(Blockly.ALIGN_RIGHT)
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setColour("#32D900");
Expand All @@ -85,13 +86,12 @@ Blockly.Blocks['otto_calibration']={init:function(){
};

Blockly.Arduino['otto_calibration']=function(block){
var valuell = block.getFieldValue('LL');
var valuerl = block.getFieldValue('RL');
var valuelf = block.getFieldValue('LF');
var valuerf = block.getFieldValue('RF');

Blockly.Arduino.setups_['otto_cal']= 'Otto.setTrims('+ valuell +','+ valuerl +',' +valuelf +','+ valuerf+');';
var code = '';
var valuell= Blockly.Arduino.valueToCode(block, 'LL', Blockly.Arduino.ORDER_ATOMIC);
var valuerl= Blockly.Arduino.valueToCode(block, 'RL', Blockly.Arduino.ORDER_ATOMIC);
var valuelf= Blockly.Arduino.valueToCode(block, 'LF', Blockly.Arduino.ORDER_ATOMIC);
var valuerf= Blockly.Arduino.valueToCode(block, 'RF', Blockly.Arduino.ORDER_ATOMIC);

var code = 'Otto.setTrims('+ valuell +','+ valuerl +',' +valuelf +','+ valuerf+');\n';
return code;
};

Expand Down Expand Up @@ -140,6 +140,24 @@ var code = 'Otto_moveLegs('+TEMPO+','+PIN_YL+','+PIN_YR+','+PIN_RL+','+PIN_RR+')
return code;
};

Blockly.Blocks['otto_moveservos'] = {init: function() {
this.appendDummyInput("") .appendField(Blockly.Msg.OTTO9_MOVE_TEXT);
this.appendValueInput("Period") .setCheck("Number").appendField(Blockly.Msg.OTTO9_MOVE_SPEED_TEXT)
this.appendValueInput("Pos") .setCheck("Number").appendField("Positions")
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setColour("#32D900");
this.setHelpUrl(Blockly.Msg.OTTO9_DIY_URL); }
};

Blockly.Arduino['otto_moveservos'] = function(block) {
var Period= Blockly.Arduino.valueToCode(block, 'Period', Blockly.Arduino.ORDER_ATOMIC);
var Pos= Blockly.Arduino.valueToCode(block, 'Pos', Blockly.Arduino.ORDER_ATOMIC);
var code = ' Otto._moveServos('+Period+', '+Pos+');';
return code;
};

Blockly.Blocks['otto_move'] = {init: function() {
this.appendDummyInput() .appendField(new Blockly.FieldImage('media/otto_bend.png', 33, 33, "*"))
.appendField(Blockly.Msg.OTTO9_MOVE_TEXT) .appendField(new Blockly.FieldDropdown(Blockly.Msg.OTTO9_MOVE_CHOICE), "otto_move_sens");
Expand Down
2 changes: 1 addition & 1 deletion www/css/blocklino.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ html,body {
}
body {
background-color: #2d2d64;
font-family: 'Nunito', sans-serif;
font-family: 'Poppins', sans-serif;
margin: 0
}

Expand Down
42 changes: 6 additions & 36 deletions www/examples/Laser_Theremin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,12 @@
<toolbox>toolbox_arduino_all</toolbox>
<block type="base_setup_loop" id="f~q0s`a;@!;gu{QM[EJB" x="159" y="32">
<statement name="DO">
<block type="otto9_configuration" id="x$2z{yKzIT.-|0a$Mm#5">
<value name="PIN_YL">
<shadow type="analog_pin" id="$9g%vNV;#c%XTO~#6z`~">
<field name="NUM">2</field>
</shadow>
</value>
<value name="PIN_YR">
<shadow type="analog_pin" id="$^SWeoOy~Pb*_teaFIj*">
<field name="NUM">3</field>
</shadow>
</value>
<value name="PIN_RL">
<shadow type="analog_pin" id="FhanDBTAflaBUz.rG{DO">
<field name="NUM">4</field>
</shadow>
</value>
<value name="PIN_RR">
<shadow type="analog_pin" id="rhoQvxi1~:^w7[1MhRGy">
<field name="NUM">5</field>
</shadow>
</value>
<value name="PIN_TRIG">
<shadow type="analog_pin" id="BKVy+|eG#imf]wJ]l.Dp">
<field name="NUM">8</field>
</shadow>
</value>
<value name="PIN_ECHO">
<shadow type="analog_pin" id="rW1$[gW(Vt#FLXIa5|WN">
<field name="NUM">9</field>
</shadow>
</value>
<value name="PIN_Buzzer">
<shadow type="analog_pin" id="*J%7ya,L_5:Kl#[RA!t^">
<field name="NUM">13</field>
</shadow>
</value>
<block type="otto9_configuration" id="p_|kYVfc^[C9}MSP_`*f">
<field name="PIN_YL">2</field>
<field name="PIN_YR">3</field>
<field name="PIN_RL">4</field>
<field name="PIN_RR">5</field>
<field name="PIN_Buzzer">13</field>
<next>
<block type="VL53L0X" id="nG^ROjOLI{G=sExSd0~q">
<next>
Expand Down
96 changes: 46 additions & 50 deletions www/examples/Ottoavoid.xml
Original file line number Diff line number Diff line change
@@ -1,68 +1,64 @@
<xml xmlns="http://www.w3.org/1999/xhtml">
<toolbox>toolbox_arduino_all</toolbox>
<block type="base_setup_loop" id="BWvEuN{WKv0tFdhzVme;" x="199" y="115">
<block type="base_setup_loop" id="F`r@+Dx;.)pY4-3tL`#:" x="-4" y="39">
<statement name="DO">
<block type="otto9_configuration" id=",ab=pZHafjm.pP(4iJBQ">
<value name="PIN_YL">
<shadow type="analog_pin" id="_*mL?#),[ORm|VLdY41B">
<field name="NUM">2</field>
</shadow>
</value>
<value name="PIN_YR">
<shadow type="analog_pin" id="k=x#J.!G*r@^n#DrP}fs">
<field name="NUM">3</field>
</shadow>
</value>
<value name="PIN_RL">
<shadow type="analog_pin" id="t9^6rKp2Z;0s/H@cR/87">
<field name="NUM">4</field>
</shadow>
</value>
<value name="PIN_RR">
<shadow type="analog_pin" id="eppvhN)zV[F4b_]-0M{g">
<field name="NUM">5</field>
</shadow>
</value>
<value name="PIN_TRIG">
<shadow type="analog_pin" id="q#R,Jv.rLQUPPZ%1/;Gd">
<field name="NUM">8</field>
</shadow>
</value>
<value name="PIN_ECHO">
<shadow type="analog_pin" id="!PsB*}B:sXg%tG.td@(k">
<field name="NUM">9</field>
</shadow>
</value>
<value name="PIN_Buzzer">
<shadow type="analog_pin" id=")3zU$+i|y4fn6+dUTEpL">
<field name="NUM">13</field>
</shadow>
</value>
<block type="otto9_configuration" id="n9;B+tF}0ucF(WmMaBxQ">
<field name="PIN_YL">2</field>
<field name="PIN_YR">3</field>
<field name="PIN_RL">4</field>
<field name="PIN_RR">5</field>
<field name="PIN_Buzzer">13</field>
<next>
<block type="ultrasonic_sensor" id="t3s}U]w0r_IToHmYthhE">
<field name="US_NUMBER">1</field>
<field name="PIN_TRIG">8</field>
<field name="PIN_ECHO">9</field>
</block>
</next>
</block>
</statement>
<statement name="LOOP">
<block type="controls_if" id="Wi[Cre+^@gHq{d))9xGk">
<block type="controls_if" id="v#AC^KzC8|aeV)By!CUO">
<value name="IF0">
<block type="otto9_obstacle" id="~mUV#jI3gnS4M}{%A/OK">
<field name="obstacle">10</field>
<block type="logic_compare" id=";]*23$g=LnBQP%%Dc9bi">
<field name="OP">LT</field>
<value name="A">
<block type="ultrasonic_distance" id="]7*7s{4G9%B(o;Rj*{$u">
<field name="US_NUMBER">1</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="FQ|{g7vrd?%*`RVW()|5">
<field name="NUM">15</field>
</shadow>
</value>
</block>
</value>
<statement name="DO0">
<block type="otto_gesture" id="2mjJ_4oMsX:CN0:WAuOg">
<block type="otto_gesture" id="=03{;).n3Ipn1E[jd{Jt">
<field name="otto_gesture">OttoConfused</field>
<next>
<block type="otto_move" id="?t==sY{EQ;u%fVW1$]AI">
<field name="otto_move_sens">BACKWARD</field>
<field name="otto_move_speed">1000</field>
<block type="controls_repeat_ext" id="PpUUERI@O,kINMoZXHjE">
<value name="TIMES">
<shadow type="math_number" id="BotrLRkn6=gb^n/1^v)X">
<field name="NUM">2</field>
</shadow>
</value>
<statement name="DO">
<block type="otto_move" id="-FZV(hp`@hn2IhOiXcSW">
<field name="otto_move_sens">BACKWARD</field>
<field name="otto_move_speed">1000</field>
</block>
</statement>
<next>
<block type="controls_repeat_ext" id="/nM)%y[DvH8VYv[h4Y~P">
<block type="controls_repeat_ext" id="U]k5iVZ{..+]9oFyirf]">
<value name="TIMES">
<block type="math_number" id="|9|.Stz4vmpP5Z6Gif(3">
<field name="NUM">3</field>
</block>
<shadow type="math_number" id="B#Mn%l}2rSgLKv*7;N80">
<field name="NUM">4</field>
</shadow>
</value>
<statement name="DO">
<block type="otto_move" id="0LYD`^*xkK.%0)n6_O@D">
<block type="otto_move" id="?)=*hV!.h_]NB`[5dAF0">
<field name="otto_move_sens">LEFT</field>
<field name="otto_move_speed">1000</field>
</block>
Expand All @@ -74,7 +70,7 @@
</block>
</statement>
<next>
<block type="otto_move" id="6(-/Aspb^!A4a?pXHbpp">
<block type="otto_move" id="=hv@XBz7rNA%~He*OF22">
<field name="otto_move_sens">FORWARD</field>
<field name="otto_move_speed">1000</field>
</block>
Expand Down
113 changes: 38 additions & 75 deletions www/examples/Ottobuzzer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,92 +2,55 @@
<toolbox>toolbox_arduino_all</toolbox>
<block type="base_setup_loop" id="sYpp.M_hPV=wn]G[Y!?e" x="-172" y="110">
<statement name="DO">
<block type="otto9_configuration" id="JVt!o#eEgwAJyISmv`VH">
<value name="PIN_YL">
<shadow type="analog_pin" id="Mw=O4}sIL,c`ZJ#cUaBU">
<field name="NUM">2</field>
</shadow>
</value>
<value name="PIN_YR">
<shadow type="analog_pin" id="/*ML7qN`x0doDB5li/M,">
<field name="NUM">3</field>
</shadow>
</value>
<value name="PIN_RL">
<shadow type="analog_pin" id="Sj=5Ly#BoHR{waTchPcJ">
<field name="NUM">4</field>
</shadow>
</value>
<value name="PIN_RR">
<shadow type="analog_pin" id="w+cK{W~3}m*9!$tM,mqs">
<field name="NUM">5</field>
</shadow>
</value>
<value name="PIN_TRIG">
<shadow type="analog_pin" id="Cg:_vsc$VeS{.GZwl+ml">
<field name="NUM">8</field>
</shadow>
</value>
<value name="PIN_ECHO">
<shadow type="analog_pin" id="+i5c?.PqO]Lnds4(ctn|">
<field name="NUM">9</field>
</shadow>
</value>
<value name="PIN_Buzzer">
<shadow type="analog_pin" id="`V|6HcCy,Qn,z([]+@i8">
<field name="NUM">13</field>
</shadow>
</value>
<block type="otto9_configuration" id=")Isv0^^Pknf/2{$?NcS-">
<field name="PIN_YL">2</field>
<field name="PIN_YR">3</field>
<field name="PIN_RL">4</field>
<field name="PIN_RR">5</field>
<field name="PIN_Buzzer">13</field>
<next>
<block type="otto_tone" id="(%O4_S3=z9%h(U)gQlvb">
<field name="otto_note">349</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="bV!T}Ry7_TrQz}u|fwsW">
<field name="otto_sound">S_connection</field>
</block>
</next>
</block>
</statement>
<statement name="LOOP">
<block type="otto_sound" id="Q$eJKk{FA1OApb%rNw{W">
<field name="otto_sound">S_superHappy</field>
<next>
<block type="otto_sound" id="(z?}^0SjcWN-28pF=1@a">
<field name="otto_sound">S_happy</field>
<next>
<block type="otto_tone" id="j-gE)_Q~XF1XMyJ#,AEY">
<field name="otto_note">349</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="B4=!mK;|;!;Th!vbBmLv">
<field name="otto_sound">S_happy_short</field>
<next>
<block type="otto_tone" id="o#IoQm?$O8NbITK14EKW">
<field name="otto_note">349</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="qwzPeW#eiC.7a`Qk)o+O">
<field name="otto_sound">S_sad</field>
<next>
<block type="otto_tone" id="Sje7Hk(*dc.N:`)!eqhZ">
<field name="otto_note">262</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="ErtOMF_l1ciih(=~6jqk">
<field name="otto_sound">S_confused</field>
<next>
<block type="otto_tone" id="MV1)N9I6nY$qqpcE);;E">
<field name="otto_note">294</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id=";*9k7[6)a=*]VfcuFN/H">
<field name="otto_sound">S_cuddly</field>
<next>
<block type="otto_tone" id="c9FH^[-7D:PKB@4OUOUD">
<field name="otto_note">294</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="FPBX;GiLt-C:x+q$7x/.">
<field name="otto_sound">S_OhOoh</field>
<next>
<block type="otto_tone" id="i9`!cbV?=UHQf!}S%vl#">
<field name="otto_note">262</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="#-g^uVv7Y_-WJP+y~`{H">
<field name="otto_sound">S_surprise</field>
<next>
<block type="otto_tone" id="xm5=xG6Wa]kE)kTH3]mf">
<field name="otto_note">440</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="dLicbMy1y:D/RW8e,f[w">
<field name="otto_sound">S_buttonPushed</field>
<next>
<block type="otto_tone" id="a,=%0bx/j+LR;kDRS/Du">
<field name="otto_note">440</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="|i=7yg^pfNfg.IT78m5P">
<field name="otto_sound">S_fart1</field>
<next>
<block type="otto_tone" id="MA9C/3:k`iadY=M;qoXh">
<field name="otto_note">392</field>
<field name="otto_note_duration">125</field>
<block type="otto_sound" id="#dTWt,cMGf+x?-lfXWxv">
<field name="otto_sound">S_sleeping</field>
<next>
<block type="otto_tone" id="kD4Z:,Cbew*iuxsYLp$4">
<field name="otto_note">392</field>
<field name="otto_note_duration">125</field>
<next>
<block type="otto_tone" id="Ln_OkcXS,g7gKzDJ)uA-">
<field name="otto_note">349</field>
<field name="otto_note_duration">125</field>
</block>
</next>
<block type="otto_sound" id="l04u29#K*lj4x/),bp:@">
<field name="otto_sound">S_disconnection</field>
</block>
</next>
</block>
Expand Down
Loading

0 comments on commit d8698ce

Please sign in to comment.