Hello all,

I have some weird problems with my pi, when I run this code:[code]import time import explorerhat as eh import pygame from pygame.locals import * def Stop(): eh.motor.one.forwards(0) eh.motor.two.forwards(0) def TurnRight(): eh.motor.one.forwards(100) eh.motor.two.forwards(0) def TurnLeft(): eh.motor.one.forwards(0) eh.motor.two.forwards(100) def Forwards(): eh.motor.one.forwards(100) eh.motor.two.forwards(100) def Backwards(): eh.motor.one.backwards(100) eh.motor.two.backwards(100) pygame.init() ## pygame.key.set_repeat(100, 100) screen = pygame.display.set_mode((200,200)) print ('Let's start!') while 1: for event in pygame.event.get(): if (event.type == KEYDOWN): if (event.key == K_w): Forwards() if (event.key == K_s): Backwards() if (event.key == K_a): TurnLeft() if (event.key == K_d): TurnRight() if (event.key == K_UP): Forwards() if (event.key == K_DOWN): Backwards() if (event.key == K_LEFT): TurnLeft() if (event.key == K_RIGHT): TurnRight() if event.type == pygame.KEYUP: Stop() [/code] The pi crashes for some weird reason. A day ago it did it all fine, but somehow it stops when I press enter. Maybe some of you smart guys can tell the N00B how to fix it.
Thanks :D


JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir