Skip to content

Commit

Permalink
adds some examples and OpenRoberta XML files
Browse files Browse the repository at this point in the history
  • Loading branch information
chpoulter committed Aug 21, 2021
1 parent f4291a1 commit 62d33ae
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/build
firmware.hex
/hex
/.settings
.cproject
.project
/.settings
29 changes: 16 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ORACCRSC := /daten/Projekte/Calliope/OpenRoberta/ora-cc-rsc/RobotMbed/libs2017
ORACCRSC := ../../OpenRoberta/ora-cc-rsc/RobotMbed/libs2017
BUILD := build
HEX := hex

MICROBITPATH := $(ORACCRSC)/microbit
MICROBITDALPATH := $(ORACCRSC)/microbit-dal
Expand All @@ -26,7 +27,8 @@ INCDEMO := $(INCLIB) \
-I $(MICROBITPATH)/inc \
-I $(BLEPATH) \
-I $(MICROBITDALPATH)/inc/types \
-I $(MICROBITDALPATH)/inc/bluetooth
-I $(MICROBITDALPATH)/inc/bluetooth \
-I lib

LDLIBS := -lnosys -lstdc++ -lsupc++ -lm -lc -lgcc -lstdc++ -lsupc++ -lm -lc -lgcc
CALLIOPELIBS := $(ORACCRSC)/microbit.a \
Expand All @@ -35,36 +37,37 @@ CALLIOPELIBS := $(ORACCRSC)/microbit.a \
$(ORACCRSC)/ble-nrf51822.a \
$(ORACCRSC)/nrf51-sdk.a \
$(ORACCRSC)/mbed-classic.a

DEMOS := CarControl.hex MotorTest.hex SimpleMotorTest.hex

all: directories lib demo
all: directories lib $(DEMOS)

directories:
mkdir -p $(BUILD)
mkdir -p $(HEX)

lib: DcMotor.a

demo: firmware.hex


firmware.hex: MotorTest.hex
srec_cat $(BLE_BOOTLOADER_RESERVED_HEX) -intel $(S110NRF51822_HEX) -intel $(BUILD)/$< -intel -o $@ -intel --line-length=44
%.hex: %.ihex
srec_cat $(BLE_BOOTLOADER_RESERVED_HEX) -intel $(S110NRF51822_HEX) -intel $(BUILD)/$< -intel -o $(HEX)/$@ -intel --line-length=44

MotorTest.hex: MotorTest
%.ihex: %.a
arm-none-eabi-objcopy -O ihex $(BUILD)/$< $(BUILD)/$@

MotorTest: MotorTest.o DcMotor.a
%.a: %.o DcMotor.a
arm-none-eabi-g++ $(LDFLAGS) -T $(NRF51822) -Wl,-Map,$(BUILD)/MotorTest.map -Wl,--start-group $(foreach i,$^,$(BUILD)/$(i)) $(LDLIBS) $(CALLIOPELIBS) -Wl,-end-group -o $(BUILD)/$@

MotorTest.o: src/MotorTest.cpp
%.o: src/%.cpp
arm-none-eabi-g++ $(INCDEMO) $(CPPLAGS) -MT $(BUILD)/$@.cpp.o -MF $(BUILD)/$@.cpp.o.d -o $(BUILD)/$@ -c $<

DcMotor.a: DcMotor.o
ar rvs $(BUILD)/$@ $(BUILD)/$^

DcMotor.o: src/DcMotor.cpp
DcMotor.o: lib/DcMotor.cpp
arm-none-eabi-g++ $(INCLIB) $(CPPLAGS) -MT $(BUILD)/$@.o -MF $(BUILD)/$@.o.d -c -o $(BUILD)/$@ $<

clean:
-rm firmware.hex $(BUILD)/*
-rm $(HEX)/* $(BUILD)/*
-rmdir $(HEX)
-rmdir $(BUILD)

1 change: 1 addition & 0 deletions OpenRoberta/CarControl.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions OpenRoberta/Motortest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<export xmlns="http://de.fhg.iais.roberta.blockly"><program><block_set xmlns="http://de.fhg.iais.roberta.blockly" robottype="calliope" xmlversion="3.1" description="" tags=""><instance x="421" y="76"><block type="robControls_start" id="kfiU{m^j=c#3/yvR^k/5" intask="true" deletable="false"><mutation declare="true"></mutation><field name="DEBUG"></field><statement name="ST"><block type="robGlobalVariables_declare" id="=K2f?g2yRd_;FA782Q]W" intask="true" deletable="false" movable="false"><mutation next="true" declaration_type="Number"></mutation><field name="VAR">a</field><field name="TYPE">Number</field><value name="VALUE"><block type="math_number" id="H-W)+u}-7kb];@6hqxQx" intask="true"><field name="NUM">0</field></block></value></block><block type="robGlobalVariables_declare" id="P.!~7`OYw-U][r}8:.2P" intask="true" deletable="false" movable="false"><mutation next="false" declaration_type="Number"></mutation><field name="VAR">b</field><field name="TYPE">Number</field><value name="VALUE"><block type="math_number" id="ub,(Nxp|V##7/)V[lZI]" intask="true"><field name="NUM">0</field></block></value></block></statement></block><block type="mbedActions_leds_off" id="Rh6Br`n.Ioj4^7.5:{M+" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide></block><block type="mbedActions_leds_on" id="`#dDOwo2y2tI}G-2Ru!L" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="DnON.hnsF8hFSLCJYftY" intask="true"><field name="COLOUR">#ff0000</field></block></value></block><block type="robControls_wait_for" id="bPdE1S^S1uT^#DI+8Fk," intask="true"><value name="WAIT0"><block type="logic_compare" id="!1Rks+WGe/O;j~],+!yP" intask="true"><field name="OP">EQ</field><value name="A"><block type="robSensors_getSample" id="bjiOt,)3e_s*CsuOXoGu" intask="true"><mutation input="KEY_PRESSED"></mutation><field name="SENSORTYPE">KEY_PRESSED</field><field name="SENSORPORT">A</field><field name="SLOT"></field></block></value><value name="B"><block type="logic_boolean" id="Xz`=tf2Da!VYP]5I;Dhp" intask="true"><field name="BOOL">TRUE</field></block></value></block></value></block><block type="robControls_wait_time" id="DI)4oAM3=^~b8:ZAYI8{" intask="true"><value name="WAIT"><block type="math_number" id="}|B~o15rkSs(f-D^AL{6" intask="true"><field name="NUM">2000</field></block></value></block><block type="mbedActions_leds_on" id="8GmZpUIUB3CJ6L}(C[0*" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="N;w+Tj;i.dEkcV#_bTc{" intask="true"><field name="COLOUR">#ffff33</field></block></value></block><block type="robControls_loopForever" id="@rXRki71mlX2:)u+!*@z" intask="true"><statement name="DO"><block type="robControls_if" id="pTCyI3F/}+J.I3GMXm0A" intask="true"><mutation elseif="4"></mutation><repetitions><value name="IF0"><block type="logic_compare" id="@E5{W`y8idkceO[a({n6" intask="true"><field name="OP">EQ</field><value name="A"><block type="robSensors_getSample" id=":+H;(}mWZ`DPsGt8}w^A" intask="true"><mutation input="KEY_PRESSED"></mutation><field name="SENSORTYPE">KEY_PRESSED</field><field name="SENSORPORT">A</field><field name="SLOT"></field></block></value><value name="B"><block type="logic_boolean" id="E{*65KSO8:A9%+#qjkMn" intask="true"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO0"><block type="variables_set" id="tp[{f]L1@:GErtH`=fv)" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field><value name="VALUE"><block type="math_arithmetic" id="?+Oxn:r.lkFyQpq69RD3" intask="true"><field name="OP">ADD</field><value name="A"><block type="variables_get" id="+`0R9Zh|EhxAsbhIK27:" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field></block></value><value name="B"><block type="math_number" id="aP4*+5xk;kw!2A_inX7M" intask="true"><field name="NUM">25</field></block></value></block></value></block><block type="mbedActions_dcmotor_set" id="atcr#ew}8RwAA4apdrVK" intask="true"><field name="PORT">1</field><value name="POWER"><block type="variables_get" id=";:=jZLp0tMUF(sBZJFpM" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field></block></value></block><block type="mbedActions_leds_on" id="B7=2I6h7/6*|k-M9Uvzj" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="nc@;7wFc6T0#ulKZMSpU" intask="true"><field name="COLOUR">#3366ff</field></block></value></block></statement><value name="IF1"><block type="logic_compare" id="wyj)/=!~X~K+SO]9%B05" intask="true"><field name="OP">EQ</field><value name="A"><block type="robSensors_getSample" id="aA[upfCcPsY!R]cxjUoi" intask="true"><mutation input="KEY_PRESSED"></mutation><field name="SENSORTYPE">KEY_PRESSED</field><field name="SENSORPORT">B</field><field name="SLOT"></field></block></value><value name="B"><block type="logic_boolean" id="/pdrAp]ebNhkr@SVM1_g" intask="true"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO1"><block type="variables_set" id="eF(Kz8OvvzhJvazMW~Px" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field><value name="VALUE"><block type="math_arithmetic" id="EB[4%x@zQc3@t}b^8/XL" intask="true"><field name="OP">ADD</field><value name="A"><block type="variables_get" id="N]0tO}?gcXMUJ;7_u4u!" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field></block></value><value name="B"><block type="math_number" id="`~YSlD*U:cAwvpA%:qXC" intask="true"><field name="NUM">25</field></block></value></block></value></block><block type="mbedActions_dcmotor_set" id="Jz%zRikK,9?V|9Aq(6Md" intask="true"><field name="PORT">2</field><value name="POWER"><block type="variables_get" id="%#HZC;W1ROX)e7Yl,P%|" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field></block></value></block><block type="mbedActions_leds_on" id="7AMI%Livg5U4z4]MH#px" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="D!ZXri|m}4qBN_#[Foua" intask="true"><field name="COLOUR">#cc33cc</field></block></value></block></statement><value name="IF2"><block type="logic_compare" id=")4~j-CN^U^s6BOC0P{oy" intask="true"><field name="OP">EQ</field><value name="A"><block type="robSensors_getSample" id="OD}k-aRIcXB[st9?5kzf" intask="true"><mutation input="PINTOUCH_PRESSED"></mutation><field name="SENSORTYPE">PINTOUCH_PRESSED</field><field name="SENSORPORT">1</field><field name="SLOT"></field></block></value><value name="B"><block type="logic_boolean" id="N6[4aadK9y[jM]fOS`mX" intask="true"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO2"><block type="variables_set" id="9}uXGFk%`U4?-h8+)#RY" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field><value name="VALUE"><block type="math_number" id="7~(fvXGkAbK=MVjZl*Fo" intask="true"><field name="NUM">0</field></block></value></block><block type="variables_set" id="=6}nLuU=+`5ovC9aQ1v5" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field><value name="VALUE"><block type="math_number" id="8*yOpX6b2l_2~2b6%F)]" intask="true"><field name="NUM">0</field></block></value></block><block type="mbedActions_dcmotor_set" id="Th1xtTg+spN#%72/Q^sp" intask="true"><field name="PORT">1</field><value name="POWER"><block type="variables_get" id="tFX!pgDs!{^~.x4_N?M{" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field></block></value></block><block type="mbedActions_dcmotor_set" id="z4P[?2Y+|#40jckgnHy!" intask="true"><field name="PORT">2</field><value name="POWER"><block type="variables_get" id="RM97ke[WhvTYcBywVyW;" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field></block></value></block><block type="mbedActions_leds_on" id="M5,D;|8:Dhmtn?i*;BsA" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="lm%E/[q+XmnLKpZVoJvi" intask="true"><field name="COLOUR">#ffffff</field></block></value></block></statement><value name="IF3"><block type="logic_compare" id="U|G1`!R7,H{t.b~fN~+D" intask="true"><field name="OP">EQ</field><value name="A"><block type="robSensors_getSample" id="HovSg7hEDE`Q2TLAZd{w" intask="true"><mutation input="PINTOUCH_PRESSED"></mutation><field name="SENSORTYPE">PINTOUCH_PRESSED</field><field name="SENSORPORT">0</field><field name="SLOT"></field></block></value><value name="B"><block type="logic_boolean" id="qlbC@n9]xL;KSmTgg@4E" intask="true"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO3"><block type="variables_set" id="Lz4(mAQ.W7j`;e;!6JyR" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field><value name="VALUE"><block type="math_arithmetic" id="dfyoDf9%B(@BS7CUgpI[" intask="true"><field name="OP">MINUS</field><value name="A"><block type="variables_get" id="*7%w#oWVi9J-w#|Z8?gM" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field></block></value><value name="B"><block type="math_number" id="tqf8:R,b|sy[G*GP96Ix" intask="true"><field name="NUM">25</field></block></value></block></value></block><block type="mbedActions_dcmotor_set" id="pVVrfse)#zZ??b?;^cDd" intask="true"><field name="PORT">1</field><value name="POWER"><block type="variables_get" id="8lm1^P{(k?BGkV2q4SIf" intask="true"><mutation datatype="Number"></mutation><field name="VAR">a</field></block></value></block><block type="mbedActions_leds_on" id="HUcCB%%-e+~+(/8z`0{o" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="*)*s+BM;o:WlyRCyW_Yo" intask="true"><field name="COLOUR">#cc0000</field></block></value></block></statement><value name="IF4"><block type="logic_compare" id=";i_`r,WKCZ]aBib-@cIJ" intask="true"><field name="OP">EQ</field><value name="A"><block type="robSensors_getSample" id="V7#A9q!+Eo_KNl@+*ULt" intask="true"><mutation input="PINTOUCH_PRESSED"></mutation><field name="SENSORTYPE">PINTOUCH_PRESSED</field><field name="SENSORPORT">3</field><field name="SLOT"></field></block></value><value name="B"><block type="logic_boolean" id="+OV9f8#)4-?|0V#-anlp" intask="true"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO4"><block type="variables_set" id="-_Z%u?bH9qd|wmQwLk6v" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field><value name="VALUE"><block type="math_arithmetic" id="]D*xI58b.vDkMW91%MFA" intask="true"><field name="OP">MINUS</field><value name="A"><block type="variables_get" id="Alf4.pBFqv~6|-TKhYWk" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field></block></value><value name="B"><block type="math_number" id="nz]7!C,3_Y|U`G.FCg7I" intask="true"><field name="NUM">25</field></block></value></block></value></block><block type="mbedActions_dcmotor_set" id="N27fmEq7!fKq[UI!N+XN" intask="true"><field name="PORT">2</field><value name="POWER"><block type="variables_get" id="[sk-JGtkA;R2Z,%i@FeP" intask="true"><mutation datatype="Number"></mutation><field name="VAR">b</field></block></value></block><block type="mbedActions_leds_on" id="}H5a)lB`n1w]03e@6AgK" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="U5zZIem`^DMw1{@bJZ|-" intask="true"><field name="COLOUR">#ff6600</field></block></value></block></statement></repetitions></block><block type="robControls_wait_time" id=",tDKf=S@6YSSgOd6!hK%" intask="true"><value name="WAIT"><block type="math_number" id="k*3rud-8/;oXTuh(js#0" intask="true"><field name="NUM">250</field></block></value></block><block type="mbedActions_leds_on" id="D*kEw:Us_dAX+P1YuCF!" intask="true"><field name="ACTORPORT">_R</field><hide name="ACTORPORT" value="_R"></hide><value name="COLOR"><block type="mbedColour_picker" id="B^Na-gn`,?+^WiJ6?bQ;" intask="true"><field name="COLOUR">#009900</field></block></value></block></statement></block></instance></block_set></program><config><block_set robottype="calliope" xmlversion="3.1" description="" tags="" xmlns="http://de.fhg.iais.roberta.blockly"><instance x="-34" y="270"><block type="robConf_key" id="Kbp:=x@gw@n.b~NH|1|e" intask="true" deletable="false"><field name="NAME">A</field><field name="PIN1">A</field></block></instance><instance x="-34" y="120"><block type="robConf_key" id="~wk*JZQvB.fj=I`N#NWp" intask="true" deletable="false"><field name="NAME">B</field><field name="PIN1">B</field></block></instance><instance x="80" y="268"><block type="robConf_accelerometer" id="#(ufvG,s^FcqI,aFn/A{" intask="true" deletable="false"><field name="NAME">_A</field></block></instance><instance x="-34" y="422"><block type="robConf_rgbled" id="lgi%C3,J!smR:eP0aal_" intask="true" deletable="false"><field name="NAME">_R</field></block></instance><instance x="-34" y="450"><block type="robConf_buzzer" id="}%d2_68IJd*7Oy{qrMR," intask="true" deletable="false"><field name="NAME">_B</field></block></instance><instance x="197" y="162"><block type="robConf_sound" id="e:4V0FcDx%9,.7xO,Ns@" intask="true" deletable="false"><field name="NAME">_S</field></block></instance><instance x="80" y="239"><block type="robConf_compass" id="O%Oi0Tq`hGEvrgHGPYY=" intask="true" deletable="false"><field name="NAME">_C</field></block></instance><instance x="715" y="41"><block type="robConf_temperature" id="0y].dnS)P)~Jjzeu3/0C" intask="true" deletable="false"><field name="NAME">_T</field></block></instance><instance x="80" y="211"><block type="robConf_gyro" id="lIT?C5y|(7FWCQIUn~pc" intask="true" deletable="false"><field name="NAME">_G</field></block></instance><instance x="197" y="190"><block type="robConf_light" id="9Ktt(7_4+XmKC0]5Zha?" intask="true" deletable="false"><field name="NAME">_L</field></block></instance><instance x="579" y="264"><block type="robConf_robot" id="robot" intask="true" deletable="false"><field name="NAME">undefined</field></block></instance></block_set></config></export>
Loading

0 comments on commit 62d33ae

Please sign in to comment.