Coretec 4wd build help needed

hi i have built my 4wd to the learn page i have done everything and at last thing in terminal says press ctrl x then y then enter but its not saving my changes as new to this and just learning this can any one help

hear are the comands i used
curl | bash

sudo pip install inputs



crontab -e

@reboot python /home/Pi/ &

wont save after crontab -e says to pres ctrl and x but it just defeats text

Did you run Sudo crontab -e ?
The first time you run it it should pop up with a choice of editors. I go with option 1 nano.

i done it step by step from the learn page this is the text i followed

It’s probably easiest to start with a NOOBS install for your Pi Zero W. Make sure you are connected to the internet so you can download the code you need. Open a Terminal window (the black and blue icon on the top toolbar) and type:

curl | bash
And answer Y (yes) to any prompts. When it’s finished it will print All done. Enjoy your Explorer HAT/pHAT! on the screen and you are ready for the next step. If it didn’t work, and said 404 not found, it might be that you’ve typed explorerphat, not explorerhat. The pHAT may be the smaller version, but it uses the same code as the big version.

Next, you need to install the Python inputs library so the robot can recognise your inputs. Still in the Terminal window, you need to type:

sudo pip install inputs
This might sit and look blank for a minute or so, but it’s doing something, honest! When it gives you your green and blue prompt again, there is one more thing. You’ve installed the Explorer pHAT, you’ve got the inputs library, so now you need to use both of these things together to drive all of your motors:

So now we have software to do everything with most controllers.

Running the robot
While the Pi is still connected to your keyboard and screen, you can test if the robot works. You need to plug the dongle that came with your Bluetooth gamepad into the Pi Zero W, and make sure the gamepad is switched on.

In the Terminal type:

Now, hold the robot off the table and push the joystick forwards. When I did this, two wheels were turning forwards, and two were going backwards. Look at the coloured wires that join to the motors going the wrong way. My yellow and orange motor was going backwards, so I needed to swap the places of those two wires so they were the opposite way round. The easiest way to do this is in the breadboard. I also needed to swap my black and white wires, so the white plugged in where the black wire was, and the black wire plugged in where the white wire was.

Try making it go forwards again, and this time it should work. Once you have forwards nailed, you have backwards sorted too.

Running the program automatically
If you want to drive your robot around, you don’t want it connected to a keyboard, etc! You need to put an instruction into the startup file so the Pi starts running the robot when it’s plugged in.

In the terminal, type:

crontab -e
which will open a little menu. Press 2. Use the arrow keys to scroll down to the bottom of the hashes (it probably says something like m h dom mon dow command). On a new line, type this exactly:

@reboot python /home/Pi/ &
Then press CTRL and x, then y, then Enter.

You have now saved the instructions. Now you just have to shutdown the Pi, unplug all the peripherals (except the controller dongle, that one’s important) and then you can run your robot from a power-bank if you want to drive it round without any wires.

Also, NOW is the time to stick the breadboard down to the car!

Happy driving!

went with option 1 ans it saved but still no control with wired controller im going to check it again

new wireless controller came this morning reinstalled and ran crontab e and selected nano and saved still same it wont do anything

So its otherwise controllable with that controller? It’s all setup and working, other than having do it automatically?

no still does nothing it works with the test in terminal back and forward but once i finish the terminal and save then unplug everything and turn back on it does nothing i have followed the instructions from the learn page its probably something simple just im not getting it this is all new to me programming stuff and not done any technical stuff for years since school and that was mid 90s

Just to clarify, does it work “with that controller” if you run your file from terminal?
Also, where is your file located, what folder etc?
And what are you entering into crontab? The full line your typing in.

it goes back and forward its the blue one from pi hut the commands i used is from the learn page i posted them further up this thread which i copied from the instructions

@reboot python3 /home/Pi/ &

still same i really dont know what to do now guess i will have to wait til the next maker fair on in Newcastle and hope some one knows how to get it working least i have 2 cool looking desk ornaments and a few more grey hairs

I have played around with an explorer pHat. I used a wireless keyboard though, not BlueTooth.

got control working in terminal left and right by making sure analog is switched on at last bit in terminal should it have a # at the start @reboot python /home/Pi/ & thanks for helping alphanumeric

is thee a setting i need to do to get it to start up once every thing is unpluged seems to be all working in terminal just not on its own

No you don’t need a # in front of the @reboot. Anything with a # in front of it is ignored.
And just so you know @reboot python will run it in python 2. And @reboot python3 will run it in python 3.
And I may see why its not working, I think it should be /home/pi, not home/Pi.
@reboot python3 /home/pi/ &

still same with that put in cant understand it controler working just not booting by itself wonder if thee is a start up menu

I don’t know why its not working.
Just for your info, the file name in the crontab entry has to match the name you gave your file, exactly, and syntax matters.

1 Like

hmm file where would the file be other is a explorer hat file but no other file

I’m referring to the file. If it was named say, it would have to be written that way in the crontab entry. And the path has to be correct. If that file isn’t in /home/pi the crontab entry isn’t going to work. It has to be an exact match to the folder its in, and the file name.