forked from stfc/ardublock
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
730 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Changelog | ||
|
||
========== Version 1.1.0 ========== | ||
|
||
Major Changes: | ||
None | ||
|
||
Minor Changes: | ||
Add blocks to support FaireBot: https://www.youtube.com/watch?v=ru-OUyFdxc4 | ||
Re-add Tilt Switch block | ||
|
||
Patches and Bug Fixes: | ||
Fix of the'pin# bug' for Tilt Switch block | ||
Re-add 'pin#' to LED block (instead of '#') | ||
Rename 'Tests' to 'Logical Operators' | ||
|
||
========== Version 1.0.0 ========== | ||
|
||
First Release (of this fork) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,12 @@ | |
ArduBlock is a Block Programming Language for Arduino. The language and functions model closely to [Arduino Language Reference](http://arduino.cc/en/Reference/HomePage) | ||
|
||
##Users | ||
Ardublock is a free graphical programming environment to make programming physical computing with Arduino as easy as drag and drop. It is based on the popular ‘scratch’ programming language, which many will already be familiar with. Ardublock generates code in C, a text based language used by the Arduino IDE, which can then be studied and modified if desired. Ardublock is an extension to the Arduino IDE so that will need to be downloaded as well (found here https://www.arduino.cc/en/Main/Software). Code written in the Arduino IDE has the file extension .abp. | ||
Ardublock is a free graphical programming environment to make programming physical computing with Arduino as easy as drag and drop. It is based on the popular ‘scratch’ programming language, which many will already be familiar with. Ardublock generates code in C, a text based language used by the Arduino IDE, which can then be studied and modified if desired. | ||
|
||
Ardublock is an extension to the Arduino IDE so that will need to be downloaded as well (found here https://www.arduino.cc/en/Main/Software). | ||
* Ardublock has been tested with version 1.0.5-r2, available here: http://arduino.googlecode.com/files/arduino-1.0.5-r2-windows.exe | ||
|
||
Code written in Ardublock has the file extension .abp. | ||
|
||
####Getting Started with ArduBlock | ||
1. Install the Arduino IDE, from https://www.arduino.cc/en/Main/Software | ||
|
@@ -52,7 +57,7 @@ The original code (https://github.com/taweili/ardublock) was developed at MIT an | |
* David Li [email protected] | ||
* HE Qichen [email protected] | ||
|
||
The author/maintainer of this branch can be contacted at [email protected]. | ||
The author/maintainer of this fork can be contacted at [email protected]. | ||
|
||
##License | ||
Copyright (C) 2011 David Li and He Qichen | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
|
||
public class FaireBotAddBackwardBlock extends TranslatorBlock | ||
{ | ||
public FaireBotAddBackwardBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
translator.addSetupCommand("pinMode( 10 , OUTPUT);"); | ||
translator.addDefinitionCommand("int FAIRE_backward = 5;"); | ||
return "memory[memoryPtr] = FAIRE_backward; memoryPtr++; while(digitalRead(FAIRE_backward) == 1) {digitalWrite(10, HIGH);} digitalWrite(10, LOW);"; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
|
||
public class FaireBotAddForwardBlock extends TranslatorBlock | ||
{ | ||
public FaireBotAddForwardBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
translator.addSetupCommand("pinMode( 8 , OUTPUT);"); | ||
translator.addDefinitionCommand("int FAIRE_forward = 3;"); | ||
return "memory[memoryPtr] = FAIRE_forward ; memoryPtr++; while(digitalRead(FAIRE_forward) == 1) {digitalWrite(8, HIGH);} digitalWrite(8, LOW);"; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
|
||
public class FaireBotAddLeftBlock extends TranslatorBlock | ||
{ | ||
public FaireBotAddLeftBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
translator.addSetupCommand("pinMode( 9 , OUTPUT);"); | ||
translator.addDefinitionCommand("int FAIRE_left = 2;"); | ||
return "memory[memoryPtr] = FAIRE_left; memoryPtr++; while(digitalRead(FAIRE_left) == 1) {digitalWrite(9, HIGH);} digitalWrite(9, LOW);"; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
|
||
public class FaireBotAddRightBlock extends TranslatorBlock | ||
{ | ||
public FaireBotAddRightBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
translator.addSetupCommand("pinMode( 7 , OUTPUT);"); | ||
translator.addDefinitionCommand("int FAIRE_right = 6;"); | ||
return "memory[memoryPtr] = FAIRE_right; memoryPtr++; while(digitalRead(FAIRE_right) == 1) {digitalWrite(7, HIGH);} digitalWrite(7, LOW);"; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
import com.ardublock.translator.block.exception.BlockException; | ||
|
||
public class FaireBotBackwardBlock extends TranslatorBlock | ||
{ | ||
public FaireBotBackwardBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0); | ||
if (!(translatorBlock instanceof NumberBlock)) | ||
{ | ||
throw new BlockException(this.blockId, "the rotation of FaireBotForward must a number"); | ||
} | ||
|
||
|
||
NumberBlock rotationNumberBlock = (NumberBlock)translatorBlock; | ||
String rotationNumber = rotationNumberBlock.toCode(); | ||
//String servoName = "servo_pin_" + pinNumber; | ||
|
||
//translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); | ||
|
||
String ret = "digitalWrite(10, HIGH);"; | ||
ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; | ||
ret = ret + "leftServo.write(0); rightServo.write(180); delay(30);}"; | ||
ret = ret + "digitalWrite(10, LOW);"; | ||
ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; | ||
|
||
//servoName + ".write( " + translatorBlock.toCode() + " );\n"; | ||
translator.addHeaderFile("Servo.h"); | ||
translator.addDefinitionCommand("Servo leftServo;"); | ||
translator.addDefinitionCommand("Servo rightServo;"); | ||
translator.addSetupCommand("pinMode( 10 , OUTPUT);"); | ||
translator.addSetupCommand("leftServo.attach(A1);"); | ||
translator.addSetupCommand("rightServo.attach(A2);"); | ||
translator.addSetupCommand("leftServo.write(90);"); | ||
translator.addSetupCommand("rightServo.write(90);"); | ||
return ret; | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotDistanceBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
import com.ardublock.translator.block.exception.BlockException; | ||
|
||
public class FaireBotDistanceBlock extends TranslatorBlock | ||
{ | ||
public FaireBotDistanceBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0); | ||
if (!(translatorBlock instanceof NumberBlock)) | ||
{ | ||
throw new BlockException(this.blockId, "the FaireBot distance must a number"); | ||
} | ||
|
||
|
||
NumberBlock distanceNumberBlock = (NumberBlock)translatorBlock; | ||
String distanceNumber = distanceNumberBlock.toCode(); | ||
|
||
translator.addDefinitionCommand("int FAIRE_movementDistance;"); | ||
return "FAIRE_movementDistance = " + distanceNumber + ";"; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.ardublock.translator.block.FaireBot; | ||
|
||
import com.ardublock.translator.Translator; | ||
import com.ardublock.translator.block.NumberBlock; | ||
import com.ardublock.translator.block.TranslatorBlock; | ||
import com.ardublock.translator.block.exception.SocketNullException; | ||
import com.ardublock.translator.block.exception.SubroutineNotDeclaredException; | ||
import com.ardublock.translator.block.exception.BlockException; | ||
|
||
public class FaireBotForwardBlock extends TranslatorBlock | ||
{ | ||
public FaireBotForwardBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) | ||
{ | ||
super(blockId, translator, codePrefix, codeSuffix, label); | ||
} | ||
|
||
@Override | ||
public String toCode() throws SocketNullException, SubroutineNotDeclaredException | ||
{ | ||
TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0); | ||
if (!(translatorBlock instanceof NumberBlock)) | ||
{ | ||
throw new BlockException(this.blockId, "the rotation of FaireBotForward must a number"); | ||
} | ||
|
||
|
||
NumberBlock rotationNumberBlock = (NumberBlock)translatorBlock; | ||
String rotationNumber = rotationNumberBlock.toCode(); | ||
//String servoName = "servo_pin_" + pinNumber; | ||
|
||
//translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); | ||
|
||
String ret = "digitalWrite(8, HIGH);"; | ||
ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; | ||
ret = ret + "leftServo.write(180); rightServo.write(0); delay(30);}"; | ||
ret = ret + "digitalWrite(8, LOW);"; | ||
ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; | ||
|
||
//servoName + ".write( " + translatorBlock.toCode() + " );\n"; | ||
translator.addHeaderFile("Servo.h"); | ||
translator.addDefinitionCommand("Servo leftServo;"); | ||
translator.addDefinitionCommand("Servo rightServo;"); | ||
translator.addSetupCommand("pinMode( 8 , OUTPUT);"); | ||
translator.addSetupCommand("leftServo.attach(A1);"); | ||
translator.addSetupCommand("rightServo.attach(A2);"); | ||
translator.addSetupCommand("leftServo.write(90);"); | ||
translator.addSetupCommand("rightServo.write(90);"); | ||
return ret; | ||
} | ||
|
||
} |
Oops, something went wrong.