From cf59786be5464b997ffc5d52189338758d7d3648 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 5 Mar 2016 23:11:03 +0000 Subject: [PATCH 01/35] Update the terminology of the readme file --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index df648b60..150a34f4 100644 --- a/README.markdown +++ b/README.markdown @@ -52,7 +52,7 @@ The original code (https://github.com/taweili/ardublock) was developed at MIT an * David Li taweili@gmail.com * HE Qichen heqichen@gmail.com -The author/maintainer of this branch can be contacted at greg.corbett@stfc.ac.uk. +The author/maintainer of this fork can be contacted at greg.corbett@stfc.ac.uk. ##License Copyright (C) 2011 David Li and He Qichen From edc34b0cc27a1f32964887e7846571379cf8a623 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 29 Mar 2016 20:03:36 +0100 Subject: [PATCH 02/35] Add a FaireBot Forward block - currently under tinkerkit menu --- .../block/FaireBot/FaireBotForwardBlock.java | 50 +++++++++++++++++++ .../com/ardublock/block/ardublock.properties | 3 ++ .../com/ardublock/block/ardublock.xml | 13 ++++- .../ardublock/block/block-mapping.properties | 3 ++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java new file mode 100644 index 00000000..66258038 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java @@ -0,0 +1,50 @@ +package com.ardublock.translator.block.FaireBot; + +import com.ardublock.translator.Translator; +import com.ardublock.translator.block.ServoBlock; +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; + +import com.ardublock.translator.block.tinker.TinkerOutputPortBlock; + +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);\n"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; + ret = ret + " leftServo.write(180);\n rightServo.write(0);\n delay(30);\n}"; + ret = ret + "digitalWrite(8, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + + //servoName + ".write( " + translatorBlock.toCode() + " );\n"; + translator.addHeaderFile("Servo.h"); + translator.addDefinitionCommand("Servo leftServo;"); + translator.addDefinitionCommand("Servo rightServo;"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + return ret; + } + +} diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index c3eedbd4..16da7a3b 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1470,3 +1470,6 @@ bg.Midi_GS=G# bg.Midi_A=A bg.Midi_AS=A# bg.Midi_B=B + +#FaireBot +bg.FaireBot_Forward=FaireBot Foward diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index 785fe954..aaac88b4 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2196,7 +2196,17 @@ - + + + + FaireBot Forward + + + + + + + @@ -9111,6 +9121,7 @@ Tinker_Button Tinker_LDR df_temperature_sensor + FaireBot_Forward diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index 44b06e8d..fa21f7fc 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -684,3 +684,6 @@ Midi_GS=com.ardublock.translator.block.jerusalab.MidiInputPortBlock Midi_A=com.ardublock.translator.block.jerusalab.MidiInputPortBlock Midi_AS=com.ardublock.translator.block.jerusalab.MidiInputPortBlock Midi_B=com.ardublock.translator.block.jerusalab.MidiInputPortBlock + +#FaireBot +FaireBot_Forward=com.ardublock.translator.block.FaireBot.FaireBotForwardBlock \ No newline at end of file From 9c09065bc8fd923985cc9515ab79d2f558576de0 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 29 Mar 2016 20:28:19 +0100 Subject: [PATCH 03/35] Add FaireBot left, right and backward - under FaireBot menu --- .../block/FaireBot/FaireBotBackwardBlock.java | 47 +++++++++++++++++++ .../block/FaireBot/FaireBotForwardBlock.java | 3 -- .../block/FaireBot/FaireBotLeftBlock.java | 47 +++++++++++++++++++ .../block/FaireBot/FaireBotRightBlock.java | 47 +++++++++++++++++++ .../com/ardublock/block/ardublock.properties | 9 ++++ .../com/ardublock/block/ardublock.xml | 40 +++++++++++++++- .../ardublock/block/block-mapping.properties | 5 +- 7 files changed, 193 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java new file mode 100644 index 00000000..dde4a715 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java @@ -0,0 +1,47 @@ +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);\n"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; + ret = ret + " leftServo.write(0);\n rightServo.write(180);\n delay(30);\n}"; + ret = ret + "digitalWrite(10, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + + //servoName + ".write( " + translatorBlock.toCode() + " );\n"; + translator.addHeaderFile("Servo.h"); + translator.addDefinitionCommand("Servo leftServo;"); + translator.addDefinitionCommand("Servo rightServo;"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + return ret; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java index 66258038..93cf8d7b 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java @@ -1,15 +1,12 @@ package com.ardublock.translator.block.FaireBot; import com.ardublock.translator.Translator; -import com.ardublock.translator.block.ServoBlock; 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; -import com.ardublock.translator.block.tinker.TinkerOutputPortBlock; - public class FaireBotForwardBlock extends TranslatorBlock { public FaireBotForwardBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java new file mode 100644 index 00000000..08d4a8e2 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java @@ -0,0 +1,47 @@ +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 FaireBotLeftBlock extends TranslatorBlock +{ + public FaireBotLeftBlock(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(7, HIGH);\n"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; + ret = ret + " leftServo.write(0);\n rightServo.write(0);\n delay(30);\n}"; + ret = ret + "digitalWrite(7, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + + //servoName + ".write( " + translatorBlock.toCode() + " );\n"; + translator.addHeaderFile("Servo.h"); + translator.addDefinitionCommand("Servo leftServo;"); + translator.addDefinitionCommand("Servo rightServo;"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + return ret; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java new file mode 100644 index 00000000..21b44130 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java @@ -0,0 +1,47 @@ +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 FaireBotRightBlock extends TranslatorBlock +{ + public FaireBotRightBlock(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(9, HIGH);\n"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; + ret = ret + " leftServo.write(180);\n rightServo.write(180);\n delay(30);\n}"; + ret = ret + "digitalWrite(9, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + + //servoName + ".write( " + translatorBlock.toCode() + " );\n"; + translator.addHeaderFile("Servo.h"); + translator.addDefinitionCommand("Servo leftServo;"); + translator.addDefinitionCommand("Servo rightServo;"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + return ret; + } + +} diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 16da7a3b..b303550b 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1472,4 +1472,13 @@ bg.Midi_AS=A# bg.Midi_B=B #FaireBot +bd.fairebot=FaireBot bg.FaireBot_Forward=FaireBot Foward +bg.FaireBot_Left=FaireBot Left +bg.FaireBot_Backward=FaireBot Backward +bg.FaireBot_Right=FaireBot Right + +bg.FaireBot_Forward.description=Move the FaireBot foward +bg.FaireBot_Left.description=Move the FaireBot left +bg.FaireBot_Backward.description=Move the FaireBot backward +bg.FaireBot_Right.description=Move the FaireBot right \ No newline at end of file diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index aaac88b4..e0a12fba 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2197,7 +2197,7 @@ - + FaireBot Forward @@ -2208,6 +2208,39 @@ + + + FaireBot Backward + + + + + + + + + + + FaireBot Left + + + + + + + + + + + FaireBot Right + + + + + + + + @@ -9121,7 +9154,12 @@ Tinker_Button Tinker_LDR df_temperature_sensor + + FaireBot_Forward + FaireBot_Left + FaireBot_Backward + FaireBot_Right diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index fa21f7fc..f5065628 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -686,4 +686,7 @@ Midi_AS=com.ardublock.translator.block.jerusalab.MidiInputPortBlock Midi_B=com.ardublock.translator.block.jerusalab.MidiInputPortBlock #FaireBot -FaireBot_Forward=com.ardublock.translator.block.FaireBot.FaireBotForwardBlock \ No newline at end of file +FaireBot_Forward=com.ardublock.translator.block.FaireBot.FaireBotForwardBlock +FaireBot_Left=com.ardublock.translator.block.FaireBot.FaireBotLeftBlock +FaireBot_Backward=com.ardublock.translator.block.FaireBot.FaireBotBackwardBlock +FaireBot_Right=com.ardublock.translator.block.FaireBot.FaireBotRightBlock \ No newline at end of file From 53f2e991aa95f0b1f5307a3355b52ee58c6444fe Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 29 Mar 2016 20:45:15 +0100 Subject: [PATCH 04/35] Remove new line characters from generated FaireBot code --- .../translator/block/FaireBot/FaireBotBackwardBlock.java | 9 +++++---- .../translator/block/FaireBot/FaireBotForwardBlock.java | 9 +++++---- .../translator/block/FaireBot/FaireBotLeftBlock.java | 9 +++++---- .../translator/block/FaireBot/FaireBotRightBlock.java | 9 +++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java index dde4a715..cd95ac96 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java @@ -30,10 +30,11 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); - String ret = "digitalWrite(10, HIGH);\n"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; - ret = ret + " leftServo.write(0);\n rightServo.write(180);\n delay(30);\n}"; - ret = ret + "digitalWrite(10, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + 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"); diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java index 93cf8d7b..85f7a5c0 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java @@ -30,10 +30,11 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); - String ret = "digitalWrite(8, HIGH);\n"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; - ret = ret + " leftServo.write(180);\n rightServo.write(0);\n delay(30);\n}"; - ret = ret + "digitalWrite(8, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + 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"); diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java index 08d4a8e2..ae594c76 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java @@ -30,10 +30,11 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); - String ret = "digitalWrite(7, HIGH);\n"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; - ret = ret + " leftServo.write(0);\n rightServo.write(0);\n delay(30);\n}"; - ret = ret + "digitalWrite(7, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + String ret = "digitalWrite(7, HIGH);"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; + ret = ret + "leftServo.write(0); rightServo.write(0); delay(30);}"; + ret = ret + "digitalWrite(7, LOW);"; + ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; //servoName + ".write( " + translatorBlock.toCode() + " );\n"; translator.addHeaderFile("Servo.h"); diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java index 21b44130..e4c3bd5c 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java @@ -30,10 +30,11 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); - String ret = "digitalWrite(9, HIGH);\n"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++)\n{"; - ret = ret + " leftServo.write(180);\n rightServo.write(180);\n delay(30);\n}"; - ret = ret + "digitalWrite(9, LOW);\nleftServo.write(90);\nrightServo.write(90);\ndelay(30);"; + String ret = "digitalWrite(9, HIGH);"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; + ret = ret + "leftServo.write(180); rightServo.write(180); delay(30);}"; + ret = ret + "digitalWrite(9, LOW);"; + ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; //servoName + ".write( " + translatorBlock.toCode() + " );\n"; translator.addHeaderFile("Servo.h"); From 58a1e090b6e11ced1d4314dc762469821ff82acc Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 29 Mar 2016 20:46:46 +0100 Subject: [PATCH 05/35] Fix indentation --- .../translator/block/FaireBot/FaireBotBackwardBlock.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java index cd95ac96..88aabaad 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java @@ -31,9 +31,9 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); String ret = "digitalWrite(10, HIGH);"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; + 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 + "digitalWrite(10, LOW);"; ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; //servoName + ".write( " + translatorBlock.toCode() + " );\n"; From 3aa21280b6dcd2bd3a8f5d5cfe13b67933253980 Mon Sep 17 00:00:00 2001 From: gregcorbett Date: Sat, 16 Apr 2016 20:22:45 +0100 Subject: [PATCH 06/35] Pull openblocks from gregcorbett/openblocks --- install_openblocks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_openblocks b/install_openblocks index 2ee78f04..4c43abfd 100755 --- a/install_openblocks +++ b/install_openblocks @@ -1,5 +1,5 @@ #! /bin/sh -git clone https://github.com/taweili/openblocks.git && \ +git clone https://github.com/gregcorbett/openblocks.git && \ cd openblocks && \ mvn install && \ cd .. && \ From 720d67866ce7e0a2bc04dd80a09f1c4ccbf04aab Mon Sep 17 00:00:00 2001 From: gregcorbett Date: Sat, 16 Apr 2016 20:39:27 +0100 Subject: [PATCH 07/35] Attempt to build ardublock as described in README --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a737e3e..e314ceba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,4 @@ language: java - oraclejdk7 - oraclejdk6 before_install: ./install_openblocks -install: mvn validate && mvn install +install: mvn validate && mvn clean package && mvn compile exec:java -Dexec.mainClass="com.ardublock.Main" From c00b5aea12fe1b52fa5b04e363489fe0f3e4ff29 Mon Sep 17 00:00:00 2001 From: gregcorbett Date: Sat, 16 Apr 2016 20:41:13 +0100 Subject: [PATCH 08/35] Attempt to debug Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e314ceba..400f67ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,4 @@ language: java - oraclejdk7 - oraclejdk6 before_install: ./install_openblocks -install: mvn validate && mvn clean package && mvn compile exec:java -Dexec.mainClass="com.ardublock.Main" +install: mvn validate From 04037d83ba904551ed57f3674682e90a7d59c283 Mon Sep 17 00:00:00 2001 From: gregcorbett Date: Sat, 16 Apr 2016 20:45:11 +0100 Subject: [PATCH 09/35] Use an empty install command for CI --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 400f67ff..0a6ea0b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,4 @@ language: java - openjdk6 - oraclejdk7 - oraclejdk6 -before_install: ./install_openblocks -install: mvn validate +before_install: ./install_openblocks && mvn validate From 364af12375ccc748dfe123ff1fb15fa901707364 Mon Sep 17 00:00:00 2001 From: gregcorbett Date: Sat, 16 Apr 2016 20:46:55 +0100 Subject: [PATCH 10/35] Add an actually blank install --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0a6ea0b9..52836a2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,5 @@ language: java - oraclejdk7 - oraclejdk6 before_install: ./install_openblocks && mvn validate + +install: From 294a452714e0ba2fb4a5e4ac6ba6dc31f609bd0c Mon Sep 17 00:00:00 2001 From: gregcorbett Date: Sat, 16 Apr 2016 23:32:59 +0100 Subject: [PATCH 11/35] Delete .travis.yml - Because it doesn't work! --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 52836a2d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: java - - openjdk7 - - openjdk6 - - oraclejdk7 - - oraclejdk6 -before_install: ./install_openblocks && mvn validate - -install: From e71785b4a93e516186e1d22b68bd2560ea16b99b Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 16 Apr 2016 23:56:57 +0100 Subject: [PATCH 12/35] Adds "Create FaireBot Memory Block". --- .../block/FaireBot/FaireBotMemoryBlock.java | 25 +++++++++++++++++++ .../com/ardublock/block/ardublock.properties | 4 ++- .../com/ardublock/block/ardublock.xml | 7 ++++++ .../ardublock/block/block-mapping.properties | 3 ++- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java new file mode 100644 index 00000000..13718fc8 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java @@ -0,0 +1,25 @@ +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 FaireBotMemoryBlock extends TranslatorBlock +{ + public FaireBotMemoryBlock(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("int memory[100];"); + translator.addSetupCommand("int memoryPtr = 0;"); + return ""; + } + +} diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index b303550b..7321c3d5 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1477,8 +1477,10 @@ bg.FaireBot_Forward=FaireBot Foward bg.FaireBot_Left=FaireBot Left bg.FaireBot_Backward=FaireBot Backward bg.FaireBot_Right=FaireBot Right +bg.FaireBot_Memory=Create FaireBot Memory bg.FaireBot_Forward.description=Move the FaireBot foward bg.FaireBot_Left.description=Move the FaireBot left bg.FaireBot_Backward.description=Move the FaireBot backward -bg.FaireBot_Right.description=Move the FaireBot right \ No newline at end of file +bg.FaireBot_Right.description=Move the FaireBot right +bg.FaireBot_Memory.description=Store commands \ No newline at end of file diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index e0a12fba..25cafe99 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2240,6 +2240,12 @@ + + + + FaireBot Memory + + @@ -9160,6 +9166,7 @@ FaireBot_Left FaireBot_Backward FaireBot_Right + FaireBot_Memory diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index f5065628..95561e9b 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -689,4 +689,5 @@ Midi_B=com.ardublock.translator.block.jerusalab.MidiInputPortBlock FaireBot_Forward=com.ardublock.translator.block.FaireBot.FaireBotForwardBlock FaireBot_Left=com.ardublock.translator.block.FaireBot.FaireBotLeftBlock FaireBot_Backward=com.ardublock.translator.block.FaireBot.FaireBotBackwardBlock -FaireBot_Right=com.ardublock.translator.block.FaireBot.FaireBotRightBlock \ No newline at end of file +FaireBot_Right=com.ardublock.translator.block.FaireBot.FaireBotRightBlock +FaireBot_Memory=com.ardublock.translator.block.FaireBot.FaireBotMemoryBlock \ No newline at end of file From 8936f2bd90951745ed3a70d7790ae9386eac4b42 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 00:09:12 +0100 Subject: [PATCH 13/35] Reset FaireBot memory block added --- .../FaireBot/FaireBotMemoryResetBlock.java | 23 +++++++++++++++++++ .../com/ardublock/block/ardublock.properties | 4 +++- .../com/ardublock/block/ardublock.xml | 7 ++++++ .../ardublock/block/block-mapping.properties | 3 ++- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryResetBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryResetBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryResetBlock.java new file mode 100644 index 00000000..9dd5f683 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryResetBlock.java @@ -0,0 +1,23 @@ +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 FaireBotMemoryResetBlock extends TranslatorBlock +{ + public FaireBotMemoryResetBlock(Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) + { + super(blockId, translator, codePrefix, codeSuffix, label); + } + + @Override + public String toCode() throws SocketNullException, SubroutineNotDeclaredException + { + return "memoryPtr = 0;"; + } + +} diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 7321c3d5..49eb25cf 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1478,9 +1478,11 @@ bg.FaireBot_Left=FaireBot Left bg.FaireBot_Backward=FaireBot Backward bg.FaireBot_Right=FaireBot Right bg.FaireBot_Memory=Create FaireBot Memory +bg.FaireBot_MemoryReset=Reset FaireBot Memory bg.FaireBot_Forward.description=Move the FaireBot foward bg.FaireBot_Left.description=Move the FaireBot left bg.FaireBot_Backward.description=Move the FaireBot backward bg.FaireBot_Right.description=Move the FaireBot right -bg.FaireBot_Memory.description=Store commands \ No newline at end of file +bg.FaireBot_Memory.description=Store commands +bg.FaireBot_MemoryReset.description=Reset saved commands \ No newline at end of file diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index 25cafe99..b0547db8 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2246,6 +2246,12 @@ FaireBot Memory + + + + FaireBot MemoryReset + + @@ -9167,6 +9173,7 @@ FaireBot_Backward FaireBot_Right FaireBot_Memory + FaireBot_MemoryReset diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index 95561e9b..6f9c82ac 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -690,4 +690,5 @@ FaireBot_Forward=com.ardublock.translator.block.FaireBot.FaireBotForwardBlock FaireBot_Left=com.ardublock.translator.block.FaireBot.FaireBotLeftBlock FaireBot_Backward=com.ardublock.translator.block.FaireBot.FaireBotBackwardBlock FaireBot_Right=com.ardublock.translator.block.FaireBot.FaireBotRightBlock -FaireBot_Memory=com.ardublock.translator.block.FaireBot.FaireBotMemoryBlock \ No newline at end of file +FaireBot_Memory=com.ardublock.translator.block.FaireBot.FaireBotMemoryBlock +FaireBot_MemoryReset=com.ardublock.translator.block.FaireBot.FaireBotMemoryResetBlock \ No newline at end of file From 8f7de1af2de427c77ea1d40108a5178fde8fb576 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 16:28:49 +0100 Subject: [PATCH 14/35] Add FaireBot "Add" commands --- .../FaireBot/FaireBotAddBackwardBlock.java | 24 +++++++++++++++ .../FaireBot/FaireBotAddForwardBlock.java | 24 +++++++++++++++ .../block/FaireBot/FaireBotAddLeftBlock.java | 24 +++++++++++++++ .../block/FaireBot/FaireBotAddRightBlock.java | 24 +++++++++++++++ .../com/ardublock/block/ardublock.properties | 16 ++++++++-- .../com/ardublock/block/ardublock.xml | 30 ++++++++++++++++++- .../ardublock/block/block-mapping.properties | 7 ++++- 7 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java new file mode 100644 index 00000000..cb3369f5 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java @@ -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; +import com.ardublock.translator.block.exception.BlockException; + +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("int FAIRE_back = 5;"); + return "memory[memoryPtr] = 5; memoryPtr++;"; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java new file mode 100644 index 00000000..2f8910ea --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java @@ -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; +import com.ardublock.translator.block.exception.BlockException; + +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("int FAIRE_forward = 3;"); + return "memory[memoryPtr] = 3; memoryPtr++;"; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java new file mode 100644 index 00000000..ca6d8b19 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java @@ -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; +import com.ardublock.translator.block.exception.BlockException; + +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("int FAIRE_left = 6;"); + return "memory[memoryPtr] = 6; memoryPtr++;"; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java new file mode 100644 index 00000000..24544010 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java @@ -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; +import com.ardublock.translator.block.exception.BlockException; + +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("int FAIRE_right = 2;"); + return "memory[memoryPtr] = 2; memoryPtr++;"; + } + +} diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 49eb25cf..a7989d7e 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1472,17 +1472,29 @@ bg.Midi_AS=A# bg.Midi_B=B #FaireBot -bd.fairebot=FaireBot +bd.Fairebot=FaireBot bg.FaireBot_Forward=FaireBot Foward bg.FaireBot_Left=FaireBot Left bg.FaireBot_Backward=FaireBot Backward bg.FaireBot_Right=FaireBot Right + bg.FaireBot_Memory=Create FaireBot Memory bg.FaireBot_MemoryReset=Reset FaireBot Memory +bg.FaireBot_AddForward=FaireBot Add Foward +bg.FaireBot_AddLeft=FaireBot Add Left +bg.FaireBot_AddBackward=FaireBot Add Backward +bg.FaireBot_AddRight=FaireBot Add Right + bg.FaireBot_Forward.description=Move the FaireBot foward bg.FaireBot_Left.description=Move the FaireBot left bg.FaireBot_Backward.description=Move the FaireBot backward bg.FaireBot_Right.description=Move the FaireBot right + bg.FaireBot_Memory.description=Store commands -bg.FaireBot_MemoryReset.description=Reset saved commands \ No newline at end of file +bg.FaireBot_MemoryReset.description=Reset saved commands + +bg.FaireBot_AddForward.description=Save "foward" in memory +bg.FaireBot_AddLeft.description=Save "left" in memory +bg.FaireBot_AddBackward.description=Save "backward" in memory +bg.FaireBot_AddRight.description=Save "right" in memory \ No newline at end of file diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index b0547db8..a5aa744c 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2253,6 +2253,30 @@ + + + FaireBot AddForward + + + + + + FaireBot AddBackward + + + + + + FaireBot AddLeft + + + + + + FaireBot AddRight + + + @@ -9167,13 +9191,17 @@ Tinker_LDR df_temperature_sensor - + FaireBot_Forward FaireBot_Left FaireBot_Backward FaireBot_Right FaireBot_Memory FaireBot_MemoryReset + FaireBot_AddForward + FaireBot_AddLeft + FaireBot_AddBackward + FaireBot_AddRight diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index 6f9c82ac..3c9900bd 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -691,4 +691,9 @@ FaireBot_Left=com.ardublock.translator.block.FaireBot.FaireBotLeftBlock FaireBot_Backward=com.ardublock.translator.block.FaireBot.FaireBotBackwardBlock FaireBot_Right=com.ardublock.translator.block.FaireBot.FaireBotRightBlock FaireBot_Memory=com.ardublock.translator.block.FaireBot.FaireBotMemoryBlock -FaireBot_MemoryReset=com.ardublock.translator.block.FaireBot.FaireBotMemoryResetBlock \ No newline at end of file +FaireBot_MemoryReset=com.ardublock.translator.block.FaireBot.FaireBotMemoryResetBlock + +FaireBot_AddForward=com.ardublock.translator.block.FaireBot.FaireBotAddForwardBlock +FaireBot_AddLeft=com.ardublock.translator.block.FaireBot.FaireBotAddLeftBlock +FaireBot_AddBackward=com.ardublock.translator.block.FaireBot.FaireBotAddBackwardBlock +FaireBot_AddRight=com.ardublock.translator.block.FaireBot.FaireBotAddRightBlock \ No newline at end of file From 243931ef7cac1087d72408ecf8d491b4a0a23283 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 16:30:38 +0100 Subject: [PATCH 15/35] Remove unused imports - From "Add" blocks --- .../translator/block/FaireBot/FaireBotAddBackwardBlock.java | 1 - .../translator/block/FaireBot/FaireBotAddForwardBlock.java | 1 - .../translator/block/FaireBot/FaireBotAddLeftBlock.java | 1 - .../translator/block/FaireBot/FaireBotAddRightBlock.java | 1 - 4 files changed, 4 deletions(-) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java index cb3369f5..f6b35aef 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java @@ -5,7 +5,6 @@ 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 FaireBotAddBackwardBlock extends TranslatorBlock { diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java index 2f8910ea..366e7026 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java @@ -5,7 +5,6 @@ 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 FaireBotAddForwardBlock extends TranslatorBlock { diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java index ca6d8b19..93d7792c 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java @@ -5,7 +5,6 @@ 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 FaireBotAddLeftBlock extends TranslatorBlock { diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java index 24544010..3559ed26 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java @@ -5,7 +5,6 @@ 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 FaireBotAddRightBlock extends TranslatorBlock { From d0cfa36d3e03a6e97244af455ef51f1aef643d50 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 19:05:25 +0100 Subject: [PATCH 16/35] Fix bugs in FaireBot modules - and converts some tabs to space --- .../FaireBot/FaireBotAddBackwardBlock.java | 25 +++--- .../FaireBot/FaireBotAddForwardBlock.java | 23 ++--- .../block/FaireBot/FaireBotAddLeftBlock.java | 23 ++--- .../block/FaireBot/FaireBotAddRightBlock.java | 23 ++--- .../block/FaireBot/FaireBotBackwardBlock.java | 71 +++++++-------- .../block/FaireBot/FaireBotForwardBlock.java | 71 +++++++-------- .../block/FaireBot/FaireBotGoBlock.java | 87 +++++++++++++++++++ .../block/FaireBot/FaireBotLeftBlock.java | 71 +++++++-------- .../block/FaireBot/FaireBotMemoryBlock.java | 4 +- .../block/FaireBot/FaireBotRightBlock.java | 71 +++++++-------- .../com/ardublock/block/ardublock.properties | 8 +- .../com/ardublock/block/ardublock.xml | 7 ++ .../ardublock/block/block-mapping.properties | 4 +- 13 files changed, 298 insertions(+), 190 deletions(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java index f6b35aef..7a8a7e03 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddBackwardBlock.java @@ -8,16 +8,17 @@ 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("int FAIRE_back = 5;"); - return "memory[memoryPtr] = 5; memoryPtr++;"; - } - + 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);"; + } + } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java index 366e7026..508cfb7f 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddForwardBlock.java @@ -8,16 +8,17 @@ 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("int FAIRE_forward = 3;"); - return "memory[memoryPtr] = 3; memoryPtr++;"; - } + 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);"; + } } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java index 93d7792c..6cf1d35a 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddLeftBlock.java @@ -8,16 +8,17 @@ 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("int FAIRE_left = 6;"); - return "memory[memoryPtr] = 6; memoryPtr++;"; - } + 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);"; + } } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java index 3559ed26..443eed13 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotAddRightBlock.java @@ -8,16 +8,17 @@ 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("int FAIRE_right = 2;"); - return "memory[memoryPtr] = 2; memoryPtr++;"; - } + 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);"; + } } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java index 88aabaad..560ec2af 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java @@ -9,40 +9,41 @@ 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("leftServo.attach(A1);"); - translator.addSetupCommand("rightServo.attach(A2);"); - return ret; - } + 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);"); + return ret; + } } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java index 85f7a5c0..a9474832 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java @@ -9,40 +9,41 @@ 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("leftServo.attach(A1);"); - translator.addSetupCommand("rightServo.attach(A2);"); - return ret; - } + 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);"); + return ret; + } } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java new file mode 100644 index 00000000..ef8d1865 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java @@ -0,0 +1,87 @@ +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 FaireBotGoBlock extends TranslatorBlock +{ + public FaireBotGoBlock(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("Servo.h"); + translator.addDefinitionCommand("int FAIRE_forward = 3;"); + translator.addDefinitionCommand("int FAIRE_backward = 5;"); + translator.addDefinitionCommand("int FAIRE_left = 2;"); + translator.addDefinitionCommand("int FAIRE_right = 6;"); + translator.addDefinitionCommand("Servo leftServo;"); + translator.addDefinitionCommand("Servo rightServo;"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + translator.addSetupCommand("leftServo.write(90);"); + translator.addSetupCommand("rightServo.write(90);"); + + String ret = "int command;"; + ret = ret + "for (int i = 0; i < memoryPtr; i++) {"; + ret = ret + "command = memory[i];"; + ret = ret + "if (command == FAIRE_forward) {"; + ret = ret + "digitalWrite(8, HIGH);"; + ret = ret + "for (int i = 0; i < 30; i++) {"; + ret = ret + "leftServo.write(180);"; + ret = ret + "rightServo.write(0);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "digitalWrite(8, LOW);"; + ret = ret + "leftServo.write(90);"; + ret = ret + "rightServo.write(90);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "else if (command == FAIRE_backward) {"; + ret = ret + "digitalWrite(10, HIGH);"; + ret = ret + "for (int i = 0; i < 30; i++) {"; + ret = ret + "leftServo.write(0);"; + ret = ret + "rightServo.write(180);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "digitalWrite(10, LOW);"; + ret = ret + "leftServo.write(90);"; + ret = ret + "rightServo.write(90);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "else if (command == FAIRE_right) {"; + ret = ret + "digitalWrite(7, HIGH);"; + ret = ret + "for (int i = 0; i < 11; i++) {"; + ret = ret + "leftServo.write(0);"; + ret = ret + "rightServo.write(0);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "digitalWrite(7, LOW);"; + ret = ret + "leftServo.write(90);"; + ret = ret + "rightServo.write(90);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "else if (command == FAIRE_left) {"; + ret = ret + "digitalWrite(9, HIGH);"; + ret = ret + "for (int i = 0; i < 11; i++) {"; + ret = ret + "leftServo.write(180);"; + ret = ret + "rightServo.write(180);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "digitalWrite(9, LOW);"; + ret = ret + "leftServo.write(90);"; + ret = ret + "rightServo.write(90);"; + ret = ret + "delay(30);"; + ret = ret + "}"; + ret = ret + "}"; + + return ret; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java index ae594c76..a3cc62f5 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java @@ -9,40 +9,41 @@ public class FaireBotLeftBlock extends TranslatorBlock { - public FaireBotLeftBlock(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(7, HIGH);"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; - ret = ret + "leftServo.write(0); rightServo.write(0); delay(30);}"; - ret = ret + "digitalWrite(7, 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("leftServo.attach(A1);"); - translator.addSetupCommand("rightServo.attach(A2);"); - return ret; - } + public FaireBotLeftBlock(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(7, HIGH);"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; + ret = ret + "leftServo.write(0); rightServo.write(0); delay(30);}"; + ret = ret + "digitalWrite(7, 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( 9 , OUTPUT);"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + return ret; + } } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java index 13718fc8..bf7fb283 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotMemoryBlock.java @@ -17,8 +17,8 @@ public FaireBotMemoryBlock(Long blockId, Translator translator, String codePrefi @Override public String toCode() throws SocketNullException, SubroutineNotDeclaredException { - translator.addSetupCommand("int memory[100];"); - translator.addSetupCommand("int memoryPtr = 0;"); + translator.addDefinitionCommand("int memory[100];"); + translator.addDefinitionCommand("int memoryPtr = 0;"); return ""; } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java index e4c3bd5c..2aa7e1de 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java @@ -9,40 +9,41 @@ public class FaireBotRightBlock extends TranslatorBlock { - public FaireBotRightBlock(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(9, HIGH);"; - ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; - ret = ret + "leftServo.write(180); rightServo.write(180); delay(30);}"; - ret = ret + "digitalWrite(9, 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("leftServo.attach(A1);"); - translator.addSetupCommand("rightServo.attach(A2);"); - return ret; - } + public FaireBotRightBlock(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(9, HIGH);"; + ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; + ret = ret + "leftServo.write(180); rightServo.write(180); delay(30);}"; + ret = ret + "digitalWrite(9, 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( 7 , OUTPUT);"); + translator.addSetupCommand("leftServo.attach(A1);"); + translator.addSetupCommand("rightServo.attach(A2);"); + return ret; + } } diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index a7989d7e..87174576 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1479,13 +1479,15 @@ bg.FaireBot_Backward=FaireBot Backward bg.FaireBot_Right=FaireBot Right bg.FaireBot_Memory=Create FaireBot Memory -bg.FaireBot_MemoryReset=Reset FaireBot Memory +bg.FaireBot_MemoryReset=FaireBot Reset Memory bg.FaireBot_AddForward=FaireBot Add Foward bg.FaireBot_AddLeft=FaireBot Add Left bg.FaireBot_AddBackward=FaireBot Add Backward bg.FaireBot_AddRight=FaireBot Add Right +bg.FaireBot_Go=FaireBot Go + bg.FaireBot_Forward.description=Move the FaireBot foward bg.FaireBot_Left.description=Move the FaireBot left bg.FaireBot_Backward.description=Move the FaireBot backward @@ -1497,4 +1499,6 @@ bg.FaireBot_MemoryReset.description=Reset saved commands bg.FaireBot_AddForward.description=Save "foward" in memory bg.FaireBot_AddLeft.description=Save "left" in memory bg.FaireBot_AddBackward.description=Save "backward" in memory -bg.FaireBot_AddRight.description=Save "right" in memory \ No newline at end of file +bg.FaireBot_AddRight.description=Save "right" in memory + +bg.FaireBot_Go.description=Run saced commands \ No newline at end of file diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index a5aa744c..2a37b2ce 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2277,6 +2277,12 @@ + + + FaireBot Go + + + @@ -9202,6 +9208,7 @@ FaireBot_AddLeft FaireBot_AddBackward FaireBot_AddRight + FaireBot_Go diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index 3c9900bd..21818a85 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -696,4 +696,6 @@ FaireBot_MemoryReset=com.ardublock.translator.block.FaireBot.FaireBotMemoryReset FaireBot_AddForward=com.ardublock.translator.block.FaireBot.FaireBotAddForwardBlock FaireBot_AddLeft=com.ardublock.translator.block.FaireBot.FaireBotAddLeftBlock FaireBot_AddBackward=com.ardublock.translator.block.FaireBot.FaireBotAddBackwardBlock -FaireBot_AddRight=com.ardublock.translator.block.FaireBot.FaireBotAddRightBlock \ No newline at end of file +FaireBot_AddRight=com.ardublock.translator.block.FaireBot.FaireBotAddRightBlock + +FaireBot_Go=com.ardublock.translator.block.FaireBot.FaireBotGoBlock \ No newline at end of file From d58c6b1cda0357ba492c37517b1a53bd09c9c21a Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 22:02:03 +0100 Subject: [PATCH 17/35] Add customisable distance and turn settings --- .../block/FaireBot/FaireBotDistanceBlock.java | 34 +++++++++++++++++++ .../block/FaireBot/FaireBotGoBlock.java | 8 ++--- .../block/FaireBot/FaireBotTurningBlock.java | 34 +++++++++++++++++++ .../com/ardublock/block/ardublock.properties | 6 +++- .../com/ardublock/block/ardublock.xml | 25 ++++++++++++++ .../ardublock/block/block-mapping.properties | 4 ++- 6 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotDistanceBlock.java create mode 100644 src/main/java/com/ardublock/translator/block/FaireBot/FaireBotTurningBlock.java diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotDistanceBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotDistanceBlock.java new file mode 100644 index 00000000..be8f7e59 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotDistanceBlock.java @@ -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 + ";"; + } + +} diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java index ef8d1865..85dcbc4c 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java @@ -33,7 +33,7 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio ret = ret + "command = memory[i];"; ret = ret + "if (command == FAIRE_forward) {"; ret = ret + "digitalWrite(8, HIGH);"; - ret = ret + "for (int i = 0; i < 30; i++) {"; + ret = ret + "for (int i = 0; i < FAIRE_movementDistance; i++) {"; ret = ret + "leftServo.write(180);"; ret = ret + "rightServo.write(0);"; ret = ret + "delay(30);"; @@ -45,7 +45,7 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio ret = ret + "}"; ret = ret + "else if (command == FAIRE_backward) {"; ret = ret + "digitalWrite(10, HIGH);"; - ret = ret + "for (int i = 0; i < 30; i++) {"; + ret = ret + "for (int i = 0; i < FAIRE_movementDistance; i++) {"; ret = ret + "leftServo.write(0);"; ret = ret + "rightServo.write(180);"; ret = ret + "delay(30);"; @@ -57,7 +57,7 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio ret = ret + "}"; ret = ret + "else if (command == FAIRE_right) {"; ret = ret + "digitalWrite(7, HIGH);"; - ret = ret + "for (int i = 0; i < 11; i++) {"; + ret = ret + "for (int i = 0; i < FAIRE_turn; i++) {"; ret = ret + "leftServo.write(0);"; ret = ret + "rightServo.write(0);"; ret = ret + "delay(30);"; @@ -69,7 +69,7 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio ret = ret + "}"; ret = ret + "else if (command == FAIRE_left) {"; ret = ret + "digitalWrite(9, HIGH);"; - ret = ret + "for (int i = 0; i < 11; i++) {"; + ret = ret + "for (int i = 0; i < FAIRE_turn; i++) {"; ret = ret + "leftServo.write(180);"; ret = ret + "rightServo.write(180);"; ret = ret + "delay(30);"; diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotTurningBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotTurningBlock.java new file mode 100644 index 00000000..e2189640 --- /dev/null +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotTurningBlock.java @@ -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 FaireBotTurningBlock extends TranslatorBlock +{ + public FaireBotTurningBlock(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 turn must a number"); + } + + + NumberBlock turnNumberBlock = (NumberBlock)translatorBlock; + String turnNumber = turnNumberBlock.toCode(); + + translator.addDefinitionCommand("int FAIRE_turn;"); + return "FAIRE_turn = " + turnNumber + ";"; + } + +} diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 87174576..b5f59fd2 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -1487,6 +1487,8 @@ bg.FaireBot_AddBackward=FaireBot Add Backward bg.FaireBot_AddRight=FaireBot Add Right bg.FaireBot_Go=FaireBot Go +bg.FaireBot_Distance=FaireBot Distance +bg.FaireBot_Turn=FaireBot Turn bg.FaireBot_Forward.description=Move the FaireBot foward bg.FaireBot_Left.description=Move the FaireBot left @@ -1501,4 +1503,6 @@ bg.FaireBot_AddLeft.description=Save "left" in memory bg.FaireBot_AddBackward.description=Save "backward" in memory bg.FaireBot_AddRight.description=Save "right" in memory -bg.FaireBot_Go.description=Run saced commands \ No newline at end of file +bg.FaireBot_Go.description=Run saved commands +bg.FaireBot_Distance.description=Set the forward/back distance of the FaireBot +bg.FaireBot_Turn.description=Set the turn of the FaireBot \ No newline at end of file diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index 2a37b2ce..956b16f3 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2283,6 +2283,29 @@ + + + + FaireBot Set Distance + + + + + + + + + + + FaireBot Set Turn + + + + + + + + @@ -9209,6 +9232,8 @@ FaireBot_AddBackward FaireBot_AddRight FaireBot_Go + FaireBot_Distance + FaireBot_Turn diff --git a/src/main/resources/com/ardublock/block/block-mapping.properties b/src/main/resources/com/ardublock/block/block-mapping.properties index 21818a85..4b2d378a 100644 --- a/src/main/resources/com/ardublock/block/block-mapping.properties +++ b/src/main/resources/com/ardublock/block/block-mapping.properties @@ -698,4 +698,6 @@ FaireBot_AddLeft=com.ardublock.translator.block.FaireBot.FaireBotAddLeftBlock FaireBot_AddBackward=com.ardublock.translator.block.FaireBot.FaireBotAddBackwardBlock FaireBot_AddRight=com.ardublock.translator.block.FaireBot.FaireBotAddRightBlock -FaireBot_Go=com.ardublock.translator.block.FaireBot.FaireBotGoBlock \ No newline at end of file +FaireBot_Go=com.ardublock.translator.block.FaireBot.FaireBotGoBlock +FaireBot_Distance=com.ardublock.translator.block.FaireBot.FaireBotDistanceBlock +FaireBot_Turn=com.ardublock.translator.block.FaireBot.FaireBotTurningBlock From 4e644d9638df276511521692d70b6c057e99ba1b Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 22:09:00 +0100 Subject: [PATCH 18/35] Add delay between command excution - to prevent arduino crashing --- .../com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java index 85dcbc4c..16df4419 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java @@ -79,6 +79,7 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio ret = ret + "rightServo.write(90);"; ret = ret + "delay(30);"; ret = ret + "}"; + ret = ret + "delay(1000);"; ret = ret + "}"; return ret; From 4aada448b16e2610eb6452ce394364fe0e4776c8 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Apr 2016 22:12:43 +0100 Subject: [PATCH 19/35] Fix tab to spaces --- .../ardublock/translator/block/FaireBot/FaireBotGoBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java index 16df4419..975ca55c 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotGoBlock.java @@ -82,7 +82,7 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio ret = ret + "delay(1000);"; ret = ret + "}"; - return ret; + return ret; } } From d4419b5e3ced6c1e632f64de227bcbe902a70a90 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 18 Apr 2016 19:56:48 +0100 Subject: [PATCH 20/35] Swaps left and right to the correct direction --- .../translator/block/FaireBot/FaireBotLeftBlock.java | 6 +++--- .../translator/block/FaireBot/FaireBotRightBlock.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java index a3cc62f5..1f3b4669 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java @@ -30,10 +30,10 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); - String ret = "digitalWrite(7, HIGH);"; + String ret = "digitalWrite(9, HIGH);"; ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; - ret = ret + "leftServo.write(0); rightServo.write(0); delay(30);}"; - ret = ret + "digitalWrite(7, LOW);"; + ret = ret + "leftServo.write(180); rightServo.write(180); delay(30);}"; + ret = ret + "digitalWrite(9, LOW);"; ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; //servoName + ".write( " + translatorBlock.toCode() + " );\n"; diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java index 2aa7e1de..f22634ae 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java @@ -29,11 +29,11 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio //String servoName = "servo_pin_" + pinNumber; //translatorBlock = this.getRequiredTranslatorBlockAtSocket(1); - - String ret = "digitalWrite(9, HIGH);"; + + String ret = "digitalWrite(7, HIGH);"; ret = ret + "for (int i = 0; i < " + rotationNumber + "; i++) {"; - ret = ret + "leftServo.write(180); rightServo.write(180); delay(30);}"; - ret = ret + "digitalWrite(9, LOW);"; + ret = ret + "leftServo.write(0); rightServo.write(0); delay(30);}"; + ret = ret + "digitalWrite(7, LOW);"; ret = ret + "leftServo.write(90); rightServo.write(90); delay(30);"; //servoName + ".write( " + translatorBlock.toCode() + " );\n"; From 18ee2133af480d144a46efb42212830f96faee15 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 18 Apr 2016 20:05:44 +0100 Subject: [PATCH 21/35] Pause servos on startup --- .../translator/block/FaireBot/FaireBotBackwardBlock.java | 2 ++ .../translator/block/FaireBot/FaireBotForwardBlock.java | 2 ++ .../ardublock/translator/block/FaireBot/FaireBotLeftBlock.java | 2 ++ .../ardublock/translator/block/FaireBot/FaireBotRightBlock.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java index 560ec2af..f6008a81 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotBackwardBlock.java @@ -43,6 +43,8 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio 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; } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java index a9474832..4b20c218 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotForwardBlock.java @@ -43,6 +43,8 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio 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; } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java index 1f3b4669..007990c8 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotLeftBlock.java @@ -43,6 +43,8 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio translator.addSetupCommand("pinMode( 9 , OUTPUT);"); translator.addSetupCommand("leftServo.attach(A1);"); translator.addSetupCommand("rightServo.attach(A2);"); + translator.addSetupCommand("leftServo.write(90);"); + translator.addSetupCommand("rightServo.write(90);"); return ret; } diff --git a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java index f22634ae..c1dd4bb4 100644 --- a/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java +++ b/src/main/java/com/ardublock/translator/block/FaireBot/FaireBotRightBlock.java @@ -43,6 +43,8 @@ public String toCode() throws SocketNullException, SubroutineNotDeclaredExceptio translator.addSetupCommand("pinMode( 7 , OUTPUT);"); translator.addSetupCommand("leftServo.attach(A1);"); translator.addSetupCommand("rightServo.attach(A2);"); + translator.addSetupCommand("leftServo.write(90);"); + translator.addSetupCommand("rightServo.write(90);"); return ret; } From 661002b98e0660376a8c67c9ba6eaa46fdcfaf62 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 17 May 2016 19:36:08 +0100 Subject: [PATCH 22/35] Add a changelog --- ChangeLog.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 ChangeLog.txt diff --git a/ChangeLog.txt b/ChangeLog.txt new file mode 100644 index 00000000..43758ac3 --- /dev/null +++ b/ChangeLog.txt @@ -0,0 +1,7 @@ +Changelog + +Add blocks to support FaireBot: https://www.youtube.com/watch?v=ru-OUyFdxc4 + +========== Version 1.0.0 ========== + +First Release (of this fork) \ No newline at end of file From 24a4b349f390d934b03836ac3f898781b2466df3 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 17 May 2016 19:46:29 +0100 Subject: [PATCH 23/35] Version bump --- ChangeLog.txt | 2 ++ src/main/resources/com/ardublock/block/ardublock.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 43758ac3..8764dc11 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,7 @@ Changelog +========== Version 1.1.0 ========== + Add blocks to support FaireBot: https://www.youtube.com/watch?v=ru-OUyFdxc4 ========== Version 1.0.0 ========== diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index b5f59fd2..42c4a3e1 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -437,7 +437,7 @@ ardublock.ui.create_refer=create reference ardublock.ui.website=Go to Web Site ardublock.ui.serialMonitor=Serial Monitor ardublock.ui.saveImage=Save as image... -ardublock.ui.version=1.0.0 +ardublock.ui.version=1.1.0 ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'Integer' variable name.\nHint: Look at the 'variable' socket on the highlighted block From 9e3b9d967fe2a26f687f09ed3a3c82e522592a4e Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 17 May 2016 19:58:43 +0100 Subject: [PATCH 24/35] Add alpha to version number --- src/main/resources/com/ardublock/block/ardublock.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 42c4a3e1..e617715b 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -437,7 +437,7 @@ ardublock.ui.create_refer=create reference ardublock.ui.website=Go to Web Site ardublock.ui.serialMonitor=Serial Monitor ardublock.ui.saveImage=Save as image... -ardublock.ui.version=1.1.0 +ardublock.ui.version=1.1.0.alpha ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'Integer' variable name.\nHint: Look at the 'variable' socket on the highlighted block From 2658ff4411ca2c4498203047a42f163667644c55 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 18 Jun 2016 16:50:50 +0100 Subject: [PATCH 25/35] Rename "Tests" to "Logical Operators" --- src/main/resources/com/ardublock/block/ardublock.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index e617715b..dbede962 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -404,7 +404,7 @@ bg.code_loop=loop bg.code_head=head bg.code_setup=setup -bd.logic=Tests +bd.logic=Logical Operators bd.communication=Communication bd.especial=Code Blocks From 26641abb43eaada8dd5db85754cea91a9ab84c2c Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 18 Jun 2016 16:53:06 +0100 Subject: [PATCH 26/35] Re add tilt switch --- src/main/resources/com/ardublock/block/ardublock.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index 956b16f3..e65be607 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -9218,6 +9218,7 @@ Tinker_LED_pwm Tinker_Button Tinker_LDR + Tinker_Tilt df_temperature_sensor From 681a125e00c958d1f781eb43ba847b65becb73ba Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 18 Jun 2016 16:55:11 +0100 Subject: [PATCH 27/35] Update ChangeLog.txt --- ChangeLog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8764dc11..14d8f12c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,8 @@ Changelog ========== Version 1.1.0 ========== Add blocks to support FaireBot: https://www.youtube.com/watch?v=ru-OUyFdxc4 +Re add Tilt Switch +Rename "Tests" to "Logical Operators" ========== Version 1.0.0 ========== From 3ef4f9446d1099e102ba3a899042f221c76c4246 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 18 Jun 2016 16:55:30 +0100 Subject: [PATCH 28/35] Version Bump --- src/main/resources/com/ardublock/block/ardublock.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index dbede962..939d71a0 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -437,7 +437,7 @@ ardublock.ui.create_refer=create reference ardublock.ui.website=Go to Web Site ardublock.ui.serialMonitor=Serial Monitor ardublock.ui.saveImage=Save as image... -ardublock.ui.version=1.1.0.alpha +ardublock.ui.version=1.1.0.beta ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'Integer' variable name.\nHint: Look at the 'variable' socket on the highlighted block From 2a1f70a162d3145be5df9c4feb56463aa99eee4b Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 18 Jun 2016 19:08:45 +0100 Subject: [PATCH 29/35] Remove deltas from .gitignore --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index f44bbba9..1aecae60 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,5 @@ bin/ *~ src/main/resources/com/ardublock/block/ardublock.zip deploy.sh -<<<<<<< HEAD -======= test-output src/main/resources/com/ardublock/block/littlebits/files ->>>>>>> upstream/master From b5917895ec215e7a3017aecd79454cbff21cb335 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 12 Jul 2016 19:34:02 +0100 Subject: [PATCH 30/35] Re-add pin# to LED block - also fixes pin# bug for Tilt switch --- ChangeLog.txt | 3 ++- src/main/resources/com/ardublock/block/ardublock.xml | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 14d8f12c..97a8d0f4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,7 +3,8 @@ Changelog ========== Version 1.1.0 ========== Add blocks to support FaireBot: https://www.youtube.com/watch?v=ru-OUyFdxc4 -Re add Tilt Switch +Re-add Tilt Switch block and fix of the pin# bug +Re-add pin# to LED block instead of # Rename "Tests" to "Logical Operators" ========== Version 1.0.0 ========== diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index e65be607..59f85312 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -2312,7 +2312,7 @@ TinkerKit LED - + @@ -2331,7 +2331,7 @@ TinkerKit LED - + @@ -2472,7 +2472,7 @@ - + From fb6fc887a0173108a62b0eae011bbf40dfdecf7d Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 12 Jul 2016 19:36:13 +0100 Subject: [PATCH 31/35] Version Bump --- src/main/resources/com/ardublock/block/ardublock.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 939d71a0..2cd7be8d 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -437,7 +437,7 @@ ardublock.ui.create_refer=create reference ardublock.ui.website=Go to Web Site ardublock.ui.serialMonitor=Serial Monitor ardublock.ui.saveImage=Save as image... -ardublock.ui.version=1.1.0.beta +ardublock.ui.version=1.1.0.beta.1 ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'Integer' variable name.\nHint: Look at the 'variable' socket on the highlighted block From 8a2c8cea5559bda5abe0d7a855b954b9d2f55436 Mon Sep 17 00:00:00 2001 From: Greg Corbett Date: Wed, 13 Jul 2016 10:39:18 +0100 Subject: [PATCH 32/35] Prevent "text in double number block" bug - does this by changing setter to take the original number block - double number block still supported for backwards compatability --- .../block/SetterVariableNumberBlock.java | 3 ++- .../block/SetterVariableNumberDoubleBlock.java | 6 +++--- .../translator/block/VariableNumberBlock.java | 2 -- .../block/VariableNumberDoubleBlock.java | 2 -- .../com/ardublock/block/ardublock.properties | 4 ++-- .../resources/com/ardublock/block/ardublock.xml | 16 +++++++--------- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/ardublock/translator/block/SetterVariableNumberBlock.java b/src/main/java/com/ardublock/translator/block/SetterVariableNumberBlock.java index df03fc62..50f551e1 100644 --- a/src/main/java/com/ardublock/translator/block/SetterVariableNumberBlock.java +++ b/src/main/java/com/ardublock/translator/block/SetterVariableNumberBlock.java @@ -20,11 +20,12 @@ public SetterVariableNumberBlock(Long blockId, Translator translator, String cod public String toCode() throws SocketNullException, SubroutineNotDeclaredException { TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0); - if (!(tb instanceof VariableNumberBlock)) { + if ((!(tb instanceof VariableNumberBlock)) && (!(tb instanceof VariableNumberDoubleBlock))) { // second check needed to be backwards compatible throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); } String ret = tb.toCode(); + translator.addDefinitionCommand("int " + ret + " = 0 ;"); tb = this.getRequiredTranslatorBlockAtSocket(1); ret = ret + " = " + tb.toCode() + " ;\n"; return ret; diff --git a/src/main/java/com/ardublock/translator/block/SetterVariableNumberDoubleBlock.java b/src/main/java/com/ardublock/translator/block/SetterVariableNumberDoubleBlock.java index 8851c429..fd5303c6 100644 --- a/src/main/java/com/ardublock/translator/block/SetterVariableNumberDoubleBlock.java +++ b/src/main/java/com/ardublock/translator/block/SetterVariableNumberDoubleBlock.java @@ -20,14 +20,14 @@ public SetterVariableNumberDoubleBlock(Long blockId, Translator translator, Stri public String toCode() throws SocketNullException, SubroutineNotDeclaredException { TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0); - if (!(tb instanceof VariableNumberDoubleBlock)) { - throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.double_number_var_slot")); + if ((!(tb instanceof VariableNumberBlock)) && (!(tb instanceof VariableNumberDoubleBlock))) { // second check needed to be backwards compatible + throw new BlockException(blockId, uiMessageBundle.getString("ardublock.error_msg.number_var_slot")); } String ret = tb.toCode(); + translator.addDefinitionCommand("double " + ret + " = 0.0 ;"); tb = this.getRequiredTranslatorBlockAtSocket(1); ret = ret + " = " + tb.toCode() + " ;\n"; - //ret = ret + " = " + "(double)" + tb.toCode() + " ;\n"; return ret; } diff --git a/src/main/java/com/ardublock/translator/block/VariableNumberBlock.java b/src/main/java/com/ardublock/translator/block/VariableNumberBlock.java index c77c4839..1a4a7464 100644 --- a/src/main/java/com/ardublock/translator/block/VariableNumberBlock.java +++ b/src/main/java/com/ardublock/translator/block/VariableNumberBlock.java @@ -17,8 +17,6 @@ public String toCode() { internalVariableName = translator.buildVariableName(label); translator.addNumberVariable(label, internalVariableName); - translator.addDefinitionCommand("int " + internalVariableName + " = 0 ;"); -// translator.addSetupCommand(internalVariableName + " = 0;"); } return codePrefix + internalVariableName + codeSuffix; } diff --git a/src/main/java/com/ardublock/translator/block/VariableNumberDoubleBlock.java b/src/main/java/com/ardublock/translator/block/VariableNumberDoubleBlock.java index 68d4f0b6..2cf2fdae 100644 --- a/src/main/java/com/ardublock/translator/block/VariableNumberDoubleBlock.java +++ b/src/main/java/com/ardublock/translator/block/VariableNumberDoubleBlock.java @@ -17,8 +17,6 @@ public String toCode() { internalVariableName = translator.buildVariableName(label); translator.addNumberVariable(label, internalVariableName); - translator.addDefinitionCommand("double " + internalVariableName + " = 0.0 ;"); -// translator.addSetupCommand(internalVariableName + " = 0;"); } return codePrefix + internalVariableName + codeSuffix; } diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 2cd7be8d..655ded94 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -365,7 +365,7 @@ bg.LCD_command_cursorOff=Cursor Off bg.LCD_command_blinkOn= Blink On bg.LCD_command_blinkOff=Blink Off bg.variable_digital=digital variable name -bg.variable_number=integer variable name +bg.variable_number=numeric variable name bg.variable_number_unsigned_long=Large integer variable name bg.variable_number_double='Decimal' variable name bg.variable_string=string name @@ -440,7 +440,7 @@ ardublock.ui.saveImage=Save as image... ardublock.ui.version=1.1.0.beta.1 ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block -ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'Integer' variable name.\nHint: Look at the 'variable' socket on the highlighted block +ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'numeric' variable name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.long_number_var_slot=Large integer variable slot must take a 'Large Integer' variable name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.double_number_var_slot=variable slot must take a 'Decimal' variable name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.char_var_slot=Char variable slot must take a char variable name.\nHint: Look at the 'variable' socket on the highlighted block diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index 59f85312..57124e63 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -1389,7 +1389,7 @@ - + @@ -1417,10 +1417,10 @@ - + - + @@ -9182,17 +9182,15 @@ number - setter_variable_number variable_number - setter_variable_digital - variable_digital + setter_variable_number + setter_variable_number_double digital-low digital-high true false - setter_variable_number_double - variable_number_double - number_double + variable_digital + setter_variable_digital servo_default From bf0874ae7feb623eccf748f651ed7b424dbd112a Mon Sep 17 00:00:00 2001 From: Greg Corbett Date: Wed, 13 Jul 2016 11:05:49 +0100 Subject: [PATCH 33/35] Fix "prefixing numbers in variable block" bug - users sometime use a "variable" block as a "number" block - this change now allows that (by removing variable prefixes) --- src/main/java/com/ardublock/translator/Translator.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ardublock/translator/Translator.java b/src/main/java/com/ardublock/translator/Translator.java index fef19c9a..0a7b0ee7 100644 --- a/src/main/java/com/ardublock/translator/Translator.java +++ b/src/main/java/com/ardublock/translator/Translator.java @@ -25,7 +25,7 @@ public class Translator { - private static final String variablePrefix = "_ABVAR_"; + private static final String variablePrefix = ""; private Set headerFileSet; private Set definitionSet; @@ -284,8 +284,7 @@ public String buildVariableName() public String buildVariableName(String reference) { - variableCnt = variableCnt + 1; - String varName = variablePrefix + variableCnt + "_"; + String varName = ""; int i; for (i=0; i Date: Wed, 13 Jul 2016 20:12:29 +0100 Subject: [PATCH 34/35] Update README to include Arduino IDE version --- README.markdown | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 150a34f4..fb26f373 100644 --- a/README.markdown +++ b/README.markdown @@ -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 From 033469851ea1627aad0b1407ce359db4ff9b6006 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 26 Jul 2016 19:39:46 +0100 Subject: [PATCH 35/35] Update ChangeLog and version numbers --- ChangeLog.txt | 13 ++++++++++--- pom.xml | 2 +- .../com/ardublock/block/ardublock.properties | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 97a8d0f4..3bb1c394 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,10 +2,17 @@ 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 and fix of the pin# bug -Re-add pin# to LED block instead of # -Rename "Tests" to "Logical Operators" +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 ========== diff --git a/pom.xml b/pom.xml index 6af31199..4e859de7 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.ardublock ardublock jar - 0.1.0-SNAPSHOT + 1.1.0-SNAPSHOT ArduBlock A Block Programming Language for Arduino diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 655ded94..698fa2ba 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -437,7 +437,7 @@ ardublock.ui.create_refer=create reference ardublock.ui.website=Go to Web Site ardublock.ui.serialMonitor=Serial Monitor ardublock.ui.saveImage=Save as image... -ardublock.ui.version=1.1.0.beta.1 +ardublock.ui.version=1.1.0 ardublock.error_msg.digital_var_slot=Digital variable slot must take a 'digital variable' name.\nHint: Look at the 'variable' socket on the highlighted block ardublock.error_msg.number_var_slot=Standard variable slot must take a standard 'numeric' variable name.\nHint: Look at the 'variable' socket on the highlighted block