Skip to content

Commit

Permalink
Merge pull request taweili#128 from karlTH/master
Browse files Browse the repository at this point in the history
add block
  • Loading branch information
taweili committed Dec 21, 2014
2 parents ab22395 + fc95a35 commit 1319206
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.ardublock.translator.block.Duinoedu;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class Driver_I2C_Stop extends TranslatorBlock {

public Driver_I2C_Stop (Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

//@Override
public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{



translator.addHeaderFile("Wire.h");
translator.addHeaderFile("MotorI2C.h");
translator.addDefinitionCommand("//libraries athttp://duinoedu.com/dl/lib/grove/EDU_MotorI2C/ \nMotorI2C mesMoteurs;");
translator.addSetupCommand("mesMoteurs.brancher();");


String ret = "mesMoteurs.stopper();\n";

return ret ;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ardublock.translator.block.Duinoedu;

import com.ardublock.translator.Translator;
import com.ardublock.translator.block.TranslatorBlock;
import com.ardublock.translator.block.exception.SocketNullException;
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class Guino_Pause extends TranslatorBlock {

public Guino_Pause (Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
super(blockId, translator, codePrefix, codeSuffix, label);
}

//@Override
public String toCode() throws SocketNullException, SubroutineNotDeclaredException
{
translator.addHeaderFile("EasyTransfer.h");
translator.addHeaderFile("EEPROM.h");
translator.addHeaderFile("Guino.h");
translator.addDefinitionCommand("int GuinoInterrupteurvirtuel = 0 ;");
translator.addDefinitionCommand("//libraries at http://duinoedu.com/dl/lib/dupont/EDU_Guino/");
translator.addSetupCommand("GUINO_BRANCHER();");
translator.addGuinoCommand(" GUINO_AFFICHER_PAUSE(GuinoInterrupteurvirtuel);");

return "GUINO_GERER_PAUSE(GuinoInterrupteurvirtuel);" ;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void actionPerformed(ActionEvent e)
translator.setGuinoProgram(true);

}
if ((block.getGenusName().equals("DuinoEDU_Guino_Title")) || (block.getGenusName().equals("DuinoEDU_Guino_Slider")) || (block.getGenusName().equals("DuinoEDU_Guino_column")) || (block.getGenusName().equals("DuinoEDU_Guino_switch")) )
if ((block.getGenusName().equals("DuinoEDU_Guino_Title")) || (block.getGenusName().equals("DuinoEDU_Guino_Slider")) || (block.getGenusName().equals("DuinoEDU_Guino_column")) || (block.getGenusName().equals("DuinoEDU_Guino_switch"))|| (block.getGenusName().equals("DuinoEDU_Guino_pause")) )
{
translator.setGuinoProgram(true);

Expand Down
10 changes: 7 additions & 3 deletions src/main/resources/com/ardublock/block/ardublock.properties
Original file line number Diff line number Diff line change
Expand Up @@ -817,11 +817,13 @@ bg.DuinoEDU_Oled_I2C=Oled I2C
bg.DuinoEDU_Oled_I2C.description=Oled I2C
bg.DuinoEDU_Oled_Clear=Oled Clear
bg.DuinoEDU_Oled_Clear.description=Oled Clear
bg.DuinoEDU_Driver_I2C_Forward=Forward
bg.DuinoEDU_Driver_I2C_Forward=Forward DRIVER I2C
bg.DuinoEDU_Driver_I2C_Forward.description=Driver I2C Forward
bg.DuinoEDU_Driver_I2C_Back=Back
bg.DuinoEDU_Driver_I2C_Stop=Stop DRIVER I2C
bg.DuinoEDU_Driver_I2C_Stop.description=Driver I2C Stop
bg.DuinoEDU_Driver_I2C_Back=Back DRIVER I2C
bg.DuinoEDU_Driver_I2C_Back.description=Driver I2C Back
bg.DuinoEDU_Driver_I2C_Pivoter=Pivote
bg.DuinoEDU_Driver_I2C_Pivoter=Pivote DRIVER I2C
bg.DuinoEDU_Driver_I2C_Pivoter.description=Driver I2C Pivote
bg.DuinoEDU_Driver_I2C_Speed_A_Motor=Speed A Motor
bg.DuinoEDU_Driver_I2C_Speed_A_Motor.description=fixe the speed of the motor between 1 and 1000
Expand Down Expand Up @@ -937,6 +939,8 @@ bg.DuinoEDU_Guino_column=Guino add column
bg.DuinoEDU_Guino_column.description=add a column in Guino
bg.DuinoEDU_Guino_switch=Guino Switch
bg.DuinoEDU_Guino_switch.description=add a Switch in Guino
bg.DuinoEDU_Guino_pause=
bg.DuinoEDU_Guino_pause.description=Pause

bc.DuinoEDU_Brightness=Brightness
bc.DuinoEDU_Display=Display
Expand Down
23 changes: 23 additions & 0 deletions src/main/resources/com/ardublock/block/ardublock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4751,6 +4751,17 @@
</Image>
</Images>
</BlockGenus>
<BlockGenus name="DuinoEDU_Driver_I2C_Stop" kind="command" color="0 255 0" initlabel="bg.DuinoEDU_Driver_I2C_Stop">
<description>
<text>Driver I2C STOP</text>
</description>

<Images>
<Image>
<FileLocation>com/ardublock/block/seeedstudio/I2CMotorDriver.png</FileLocation>
</Image>
</Images>
</BlockGenus>

<BlockGenus name="DuinoEDU_Driver_I2C_Back" kind="command" color="0 255 0" initlabel="bg.DuinoEDU_Driver_I2C_Back">
<description>
Expand Down Expand Up @@ -5637,6 +5648,16 @@
</description>

</BlockGenus>
<BlockGenus name="DuinoEDU_Guino_pause" kind="command" color="0 255 0" initlabel="bg.DuinoEDU_Guino_pause">
<description>
<text>Guino column</text>
</description>
<Images>
<Image>
<FileLocation>com/ardublock/block/seeedstudio/Guino_Pause.png</FileLocation>
</Image>
</Images>
</BlockGenus>
<BlockGenus name="DuinoEDU_Guino_Read" kind="command" color="0 255 0" initlabel="bg.DuinoEDU_Guino_Read">
<description>
<text>Guino Read</text>
Expand Down Expand Up @@ -8931,6 +8952,7 @@
<BlockGenusMember>DuinoEDU_Guino_Read</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Guino_Slider</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Guino_switch</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Guino_pause</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Guino_Title</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Guino_column</BlockGenusMember>
</BlockDrawer>
Expand Down Expand Up @@ -9106,6 +9128,7 @@
<BlockGenusMember>keyboard_post</BlockGenusMember>
<BlockGenusMember>keyboard_compare</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Driver_I2C_Forward</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Driver_I2C_Stop</BlockGenusMember>
<BlockGenusMember>DuinoEDU_Driver_I2C_Speed_A_Motor</BlockGenusMember>
<BlockGenusMember>DuinoEDU_shildbot_Forward</BlockGenusMember>
<BlockGenusMember>DuinoEDU_shildbot_Stop</BlockGenusMember>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ DuinoEDU_Display_Digital_Tube2=com.ardublock.translator.block.Duinoedu.Digital_T
DuinoEDU_Oled_I2C=com.ardublock.translator.block.Duinoedu.Oled_I2C
DuinoEDU_Oled_Clear=com.ardublock.translator.block.Duinoedu.Oled_Clear
DuinoEDU_Driver_I2C_Forward=com.ardublock.translator.block.Duinoedu.Driver_I2C_Forward
DuinoEDU_Driver_I2C_Stop=com.ardublock.translator.block.Duinoedu.Driver_I2C_Stop
DuinoEDU_Driver_I2C_Back=com.ardublock.translator.block.Duinoedu.Driver_I2C_Back
DuinoEDU_Driver_I2C_Pivoter=com.ardublock.translator.block.Duinoedu.Driver_I2C_Pivoter
DuinoEDU_Driver_I2C_Speed_A_Motor=com.ardublock.translator.block.Duinoedu.Driver_I2C_Speed_A_Motor
Expand Down Expand Up @@ -453,6 +454,7 @@ DuinoEDU_Guino_Title=com.ardublock.translator.block.Duinoedu.Guino_Title
DuinoEDU_Guino_Slider=com.ardublock.translator.block.Duinoedu.Guino_Slider
DuinoEDU_Guino_column=com.ardublock.translator.block.Duinoedu.Guino_Column
DuinoEDU_Guino_switch=com.ardublock.translator.block.Duinoedu.Guino_Switch
DuinoEDU_Guino_pause=com.ardublock.translator.block.Duinoedu.Guino_Pause
#Panda
panda_i0=com.ardublock.translator.block.panda.PandaInputPortBlock
panda_i1=com.ardublock.translator.block.panda.PandaInputPortBlock
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1319206

Please sign in to comment.