Giter Site home page Giter Site logo

octoprint-fanspeedmirror's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

octoprint-fanspeedmirror's Issues

what's the use case

cool idea, but what's the use case? I'm assuming it's to control auxiliary fans?

Index Error: list index out of range

Hi there!

As I mentioned before I am trying to control a laser by a PWM output from a GPIO pin. I really know near to nothing about python or bash. So far I got the script which I added at the bottom. I am trying to execute it in Putty and it gives me the error:

Traceback (most recent call last):
File "fan.py", line 8, in
s = int(sys.argv[1])
IndexError: list index out of range

If I just enter a number for s it works perfectly fine (I am monitoring the pin with an oscilloscope). However I want s to be the number entered behind every M106 command. The PWM output should stay on till the next M106 command is entered therefore the 'while 1:'
I don't know if that is the right way to do it. When I enter the script path in the plugin and then issue a M106 S128 command nothing happens.

fan.py script:

#!/usr/bin/python3
import sys
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)

s = int(sys.argv[1])
dc = s*100/255

p = GPIO.PWM(11,1000) # channel=11 frequency=1kHz
p.start(0)
try:
while 1:
p.ChangeDutyCycle(dc)
except KeyboardInterrupt:
pass
p.stop()
GPIO.cleanup()

Please tell me if you need any further information. Thank you for your time! :)

About GPIO PWM FAN

Hello I want Set GPIO14 to control PWM fan,
how to change the py script, can you give me a hint?thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.