Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Work without potentiometer #4

Open
RanzerScore90 opened this issue Feb 14, 2023 · 1 comment
Open

Can't Work without potentiometer #4

RanzerScore90 opened this issue Feb 14, 2023 · 1 comment

Comments

@RanzerScore90
Copy link

RanzerScore90 commented Feb 14, 2023

The Game is too fast without adjusting the snakespeed with a potentiometer, and I tried to Change the snakespeed in conf but the default value is 1, 0 doesn't work, and more than 1 - 1023 doesn't even affect the snakespeed. I literally don't know why or I'm just dumb

Edit: I'm not having a good day but here we go.
I tried changing the other piece of code that maps the variable to the potentiometer value, didn't work.

@ondt
Copy link
Owner

ondt commented Feb 15, 2023

Hi, you might want to delete this part of the code on lines 151..152:

		float raw = mapf(analogRead(Pin::potentiometer), 0, 1023, 0, 1);
		snakeSpeed = mapf(pow(raw, 3.5), 0, 1, 10, 1000); // change the speed exponentially

After that, you should be able to set int snakeSpeed = 1; to a custom value.

@github-staff github-staff deleted a comment Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants