Navigation

    Robolink logo
    • Register
    • Login
    • Search
    • [[global:header.categories]]
    • [[global:header.recent]]
    • [[global:header.tags]]
    • [[global:header.popular]]
    • [[global:header.users]]
    • [[global:header.groups]]
    1. Home
    2. stemkids
    As of September 2021, we have moved technical support to Robolink Help

    Welcome to the Robolink Community forum!

    You can post here to interact with others in the Robolink community. We're checking it weekly, and we'll respond to some messages. If you're looking for technical support, head over to Robolink Help.
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 2
    • Best 0
    • Groups 0

    stemkids

    @stemkids

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    stemkids Unfollow Follow

    Latest posts made by stemkids

    • Python Code Problem between Blockly and PyCharm

      Hi
      Need help. I have set up both Blockly and PyCharm to code to our CoDrone Pros at our school. To we have found that the Python code seen in Blockly when copied and pasted into PyCharm does not want to recognise Python commands. See the Blckly generated code here...

      import CoDrone

      drone = CoDrone.CoDrone()
      drone.pair(drone.Nearest)

      addEvent('whenKeyPress', function (Keyboard.SPACEBAR){
      drone.takeoff()
      while drone.is_code_running():
      if Key.KEY_PRESSED == Keyboard.z:
      drone.move(1,0,0,0,50)
      if Key.KEY_PRESSED == Keyboard.x:
      drone.move(1,0,0,0,-20)
      if Key.KEY_PRESSED == Keyboard.UP:
      drone.move(1,0,50,0,0)
      if Key.KEY_PRESSED == Keyboard.DOWN:
      drone.move(1,0,-50,0,0)
      if Key.KEY_PRESSED == Keyboard.LEFT:
      drone.move(1,0,0,-50,0)
      if Key.KEY_PRESSED == Keyboard.RIGHT:
      drone.move(1,0,0,50,0)
      if Key.KEY_PRESSED == Keyboard.q:
      drone.land()
      })

      Not anything exciting but keyboard controls.

      When pasted into a new CoDrone snip in PyCharm it does not work.
      Here is the response...

      posted in CoDrone Lite/Pro
      S
      stemkids
    • HELP RE Python in Blockly and PyCharm

      Hi I am having a confusion moment so any help welcomed.
      We have set up PyCharm to connect to out set of CoDrone pros and can do flights. However to help out students we also have Blockly running. When I produce a program in Blockly and see the Python generated code ( see code to just fly by keyboard attached below ) I then copied this into a PyCharm program with the CoDrone addition and it did not run and gave the error syntax code ( see below at the end ).

      Does Blockly Python not = Python in PyCharm ???? Is there a manual for syntax commands I can print for my students and not the interactive text syntax inside of PyCharm ???
      Thanks for any help Mike

      BLOCKLY CODE :

      import CoDrone

      drone = CoDrone.CoDrone()
      drone.pair(drone.Nearest)

      addEvent('whenKeyPress', function (Keyboard.SPACEBAR){
      drone.takeoff()
      while drone.is_code_running():
      if Key.KEY_PRESSED == Keyboard.z:
      drone.move(1,0,0,0,50)
      if Key.KEY_PRESSED == Keyboard.x:
      drone.move(1,0,0,0,-20)
      if Key.KEY_PRESSED == Keyboard.UP:
      drone.move(1,0,50,0,0)
      if Key.KEY_PRESSED == Keyboard.DOWN:
      drone.move(1,0,-50,0,0)
      if Key.KEY_PRESSED == Keyboard.LEFT:
      drone.move(1,0,0,-50,0)
      if Key.KEY_PRESSED == Keyboard.RIGHT:
      drone.move(1,0,0,50,0)
      if Key.KEY_PRESSED == Keyboard.q:
      drone.land()
      })

      ERROR in PyCharm

      File "C:/Users/mjones/PycharmProjects/pythonProject2/basic take off.py", line 6
      addEvent('whenKeyPress', function (Keyboard.SPACEBAR){
      ^
      SyntaxError: invalid syntax

      Process finished with exit code 1

      posted in CoDrone Lite/Pro
      S
      stemkids