Connecting MegaPi and Arduino?


Is it possible to merge normal Arduino code and MegaPi code?

My classmates made a project where we primarily use Arduino code but we’re going to use the clamp from the ultimate 2.0 but we already have a code for the wheels and ultrasonic sensor using ArduinoUNO. Now the goal is that we have to connect the coding from the ultrasonic sensor to the clamp so it can pick up something and drop it after it turns around.

So like
Ultrasonic sensor senses an obstacle (typically trash)
DC motors stop and clamp arm goes down to pick up trash
Clamp picks up trash, turns around, and places trash in basket
Clamp goes back to initial position and repeats cycle

Was also meaning to ask, is it possible to make conditions for a DC motor since we’re gonna be using the turntable that was meant for the 3D motion capture bot.

I know this sounds confusing and I honestly am confused too because my classmates insist on doing this rather than go purely on MegaPi because we already blew so much money on Arduino products when they planned without me.



I’m sure there is a way… I might look into this since I have a MegaPi, but I’ve been very busy (sorry for the late reply), so I’m not sure when I will be able to do some testing.

Good luck.


No worries. I still have two weeks until the showcasing but I’ll try to do some testing while waiting :>


@AAA OK, so let me see if I understand what you are saying:

  • You have one board, the MegaPi that you would like to program to do the things you mentioned
  • You want to code the board in Arduino C (because blocks have limited functionality)
  • You are wondering if there is a way to interact with MegaPi easily through Arduino C (it’s motors, etc.) so that you can use Arduino code for it and your sensors

Yes, you can, but the most easy way to do what you need would probably be to create custom blocks for MegaPi and code it through blocks instead (because it is hard to find an import makeblock MegaPi libraries into other editors).

If you want to do that, let me know, and I can try to see what I can do.
Good luck!


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.