diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2016/ultrasonic_hcsr04.ast b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2016/ultrasonic_hcsr04.ast new file mode 100644 index 0000000000..aa83624663 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2016/ultrasonic_hcsr04.ast @@ -0,0 +1,12 @@ + +(repeat [FOREVER, BoolConst[value: true]] +Var [abstand] := SensorExpr [UltrasonicSensor [U1, DISTANCE, - EMPTY_SLOT -]] + +AktionStmt [DisplayTextAction [TEXT, FunctionExpr [MathSingleFunct [ROUND, [Var [abstand]]]]]]WaitTimeStmt[time: NumConst[value: 1000]] +) + +Var [abstand] := SensorExpr [UltrasonicSensor [U2, DISTANCE, - EMPTY_SLOT -]] + + +Var [abstand] := SensorExpr [UltrasonicSensor [U3, DISTANCE, - EMPTY_SLOT -]] + diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2017/ultrasonic_hcsr04.ast b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2017/ultrasonic_hcsr04.ast new file mode 100644 index 0000000000..aa83624663 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2017/ultrasonic_hcsr04.ast @@ -0,0 +1,12 @@ + +(repeat [FOREVER, BoolConst[value: true]] +Var [abstand] := SensorExpr [UltrasonicSensor [U1, DISTANCE, - EMPTY_SLOT -]] + +AktionStmt [DisplayTextAction [TEXT, FunctionExpr [MathSingleFunct [ROUND, [Var [abstand]]]]]]WaitTimeStmt[time: NumConst[value: 1000]] +) + +Var [abstand] := SensorExpr [UltrasonicSensor [U2, DISTANCE, - EMPTY_SLOT -]] + + +Var [abstand] := SensorExpr [UltrasonicSensor [U3, DISTANCE, - EMPTY_SLOT -]] + diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2017NoBlue/ultrasonic_hcsr04.ast b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2017NoBlue/ultrasonic_hcsr04.ast new file mode 100644 index 0000000000..aa83624663 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/astGenerated/calliope2017NoBlue/ultrasonic_hcsr04.ast @@ -0,0 +1,12 @@ + +(repeat [FOREVER, BoolConst[value: true]] +Var [abstand] := SensorExpr [UltrasonicSensor [U1, DISTANCE, - EMPTY_SLOT -]] + +AktionStmt [DisplayTextAction [TEXT, FunctionExpr [MathSingleFunct [ROUND, [Var [abstand]]]]]]WaitTimeStmt[time: NumConst[value: 1000]] +) + +Var [abstand] := SensorExpr [UltrasonicSensor [U2, DISTANCE, - EMPTY_SLOT -]] + + +Var [abstand] := SensorExpr [UltrasonicSensor [U3, DISTANCE, - EMPTY_SLOT -]] + diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2016/ultrasonic_hcsr04.txt b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2016/ultrasonic_hcsr04.txt new file mode 100644 index 0000000000..3897e3fce2 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2016/ultrasonic_hcsr04.txt @@ -0,0 +1,6 @@ +Sensors: +[] +Actors: +[UsedActor [U1, ULTRASONIC], UsedActor [, DISPLAY], UsedActor [U2, ULTRASONIC], UsedActor [U3, ULTRASONIC]] +Methods: +[GET_ULTARSONIC_SAMPLE, ROUND] \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2017/ultrasonic_hcsr04.txt b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2017/ultrasonic_hcsr04.txt new file mode 100644 index 0000000000..3897e3fce2 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2017/ultrasonic_hcsr04.txt @@ -0,0 +1,6 @@ +Sensors: +[] +Actors: +[UsedActor [U1, ULTRASONIC], UsedActor [, DISPLAY], UsedActor [U2, ULTRASONIC], UsedActor [U3, ULTRASONIC]] +Methods: +[GET_ULTARSONIC_SAMPLE, ROUND] \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2017NoBlue/ultrasonic_hcsr04.txt b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2017NoBlue/ultrasonic_hcsr04.txt new file mode 100644 index 0000000000..3897e3fce2 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/collectorResults/calliope2017NoBlue/ultrasonic_hcsr04.txt @@ -0,0 +1,6 @@ +Sensors: +[] +Actors: +[UsedActor [U1, ULTRASONIC], UsedActor [, DISPLAY], UsedActor [U2, ULTRASONIC], UsedActor [U3, ULTRASONIC]] +Methods: +[GET_ULTARSONIC_SAMPLE, ROUND] \ No newline at end of file diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2016/ultrasonic_hcsr04.cpp b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2016/ultrasonic_hcsr04.cpp new file mode 100644 index 0000000000..9cb4870485 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2016/ultrasonic_hcsr04.cpp @@ -0,0 +1,37 @@ +#define _GNU_SOURCE + +#include "MicroBit.h" +#include "NEPODefs.h" +#include +#include +#include +MicroBit _uBit; + + +double getUltarsonicSample(double factor, MicroBitPin trigPin, MicroBitPin echoPin); + +double ___abstand; + +int main() +{ + _uBit.init(); + ___abstand = 0; + + while ( true ) { + ___abstand = getUltarsonicSample(58, _uBit.io.P8, _uBit.io.P2); + _uBit.display.scroll(ManagedString(round(___abstand))); + _uBit.sleep(1000); + _uBit.sleep(_ITERATION_SLEEP_TIMEOUT); + } + ___abstand = getUltarsonicSample(58, _uBit.io.P9, _uBit.io.P7); + ___abstand = (_uBit.io.P2.readPulseHigh() * 0.017); + release_fiber(); +} + +double getUltarsonicSample(double factor, MicroBitPin trigPin, MicroBitPin echoPin) { + trigPin.setDigitalValue(1); + _uBit.sleep(25); + trigPin.setDigitalValue(0); + + return ((double)_uBit.io.P2.readPulseHigh()) / factor; +} diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2017/ultrasonic_hcsr04.cpp b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2017/ultrasonic_hcsr04.cpp new file mode 100644 index 0000000000..9cb4870485 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2017/ultrasonic_hcsr04.cpp @@ -0,0 +1,37 @@ +#define _GNU_SOURCE + +#include "MicroBit.h" +#include "NEPODefs.h" +#include +#include +#include +MicroBit _uBit; + + +double getUltarsonicSample(double factor, MicroBitPin trigPin, MicroBitPin echoPin); + +double ___abstand; + +int main() +{ + _uBit.init(); + ___abstand = 0; + + while ( true ) { + ___abstand = getUltarsonicSample(58, _uBit.io.P8, _uBit.io.P2); + _uBit.display.scroll(ManagedString(round(___abstand))); + _uBit.sleep(1000); + _uBit.sleep(_ITERATION_SLEEP_TIMEOUT); + } + ___abstand = getUltarsonicSample(58, _uBit.io.P9, _uBit.io.P7); + ___abstand = (_uBit.io.P2.readPulseHigh() * 0.017); + release_fiber(); +} + +double getUltarsonicSample(double factor, MicroBitPin trigPin, MicroBitPin echoPin) { + trigPin.setDigitalValue(1); + _uBit.sleep(25); + trigPin.setDigitalValue(0); + + return ((double)_uBit.io.P2.readPulseHigh()) / factor; +} diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2017NoBlue/ultrasonic_hcsr04.cpp b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2017NoBlue/ultrasonic_hcsr04.cpp new file mode 100644 index 0000000000..9cb4870485 --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/calliope2017NoBlue/ultrasonic_hcsr04.cpp @@ -0,0 +1,37 @@ +#define _GNU_SOURCE + +#include "MicroBit.h" +#include "NEPODefs.h" +#include +#include +#include +MicroBit _uBit; + + +double getUltarsonicSample(double factor, MicroBitPin trigPin, MicroBitPin echoPin); + +double ___abstand; + +int main() +{ + _uBit.init(); + ___abstand = 0; + + while ( true ) { + ___abstand = getUltarsonicSample(58, _uBit.io.P8, _uBit.io.P2); + _uBit.display.scroll(ManagedString(round(___abstand))); + _uBit.sleep(1000); + _uBit.sleep(_ITERATION_SLEEP_TIMEOUT); + } + ___abstand = getUltarsonicSample(58, _uBit.io.P9, _uBit.io.P7); + ___abstand = (_uBit.io.P2.readPulseHigh() * 0.017); + release_fiber(); +} + +double getUltarsonicSample(double factor, MicroBitPin trigPin, MicroBitPin echoPin) { + trigPin.setDigitalValue(1); + _uBit.sleep(25); + trigPin.setDigitalValue(0); + + return ((double)_uBit.io.P2.readPulseHigh()) / factor; +} diff --git a/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/ultrasonic_hcsr04.xml b/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/ultrasonic_hcsr04.xml new file mode 100644 index 0000000000..9a0a8ffabf --- /dev/null +++ b/OpenRobertaServer/src/test/resources/crossCompilerTests/robotSpecific/calliope/ultrasonic_hcsr04.xml @@ -0,0 +1 @@ +abstandNumber0abstandDISTANCEU1TEXTROUNDabstand1000abstandDISTANCEU2abstandDISTANCEU3U158C17C16BB_S_L_G_CundefinedU258C10C11AA_A_T_RU31_B \ No newline at end of file