# E2-driven car-problem with the code.

Hi. I just made an E2 chip, which theoretically allows me to drive my car. But there is a little problem - nothing works, no errors from E2 side(probably, at least the editor doesn’t show any), and everything is wired up correctly. It only doesn’t move. Here is the code I made:

``````

@name Sterowanie;
@inputs W A S D
@outputs Hyleft Hyright Thrust
@persist
@trigger All

if(A) {Hyleft=40} else {Hyleft=73}
if(A) {Hyright=80} else {Hyright=73}
if(D) {Hyleft=80} else {Hyleft=73}
if(D) {Hyright=40} else {Hyright=73}
if(W) {Thrust=1} else {Thrust=0}
if(S) {Thrust=-1} else {Thrust=0}

``````

Hyleft and Hyright is used for wire hydraulics, which I also made. Maybe it’s problem with that hydraulics, not mine E2? Anyway, any clue will help

Wrong section. Actually, wrong website.

So if you don’t have A pressed, it sets the hydraulics to 73. If you don’t have D pressed, it sets the hydraulics to 73. If you’re holding A, you’re not holding D, and vice versa. You have the same issue with your forward/backward code.

Here’s a simpler way to do it:

``````

@name Sterowanie;
@inputs W A S D
@outputs Hyleft Hyright Thrust
@persist
@trigger All

Hyleft = 73 + 20 * (D - A)
Hyright = 73 - 20 * (D - A)
Thrust = W - S

``````

So much cleaner than the conditionals.

This is asking for help mr. spergy mcspergsalot. there’s no issue with him asking a question here.

Thanks a lot. I didn’t noticed that logic mistake in my code And when I was posting this, wiremod forums literally flew off from my head, I completely forgot that they exist. Again-thanks for help, and any Administrator/Moderator can close this topic, or even remove it, it’s kinda useless I think.