Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
/* //arduino code for controling server that drives drawing machine A0 is the servo A1 is the potentiometer for fine turning height */ Servo myservo; // create servo object to control a servo int pos = 0; // variable to store the servo position int minx = 0; int trans = 0; //var for changing var from A1 int lim = 25; void setup() { //delay(5000); Serial.begin(9600); myservo.attach(9); // attaches the servo on pin 9 to the servo object is pin9 ==A0? pos = myservo.read(); // if the servo is high, or low set servo position to 0 if (pos > 0 || pos < 0){ myservo.write(30); } } void loop() { int sensorValue = analogRead(A0); //resistors on PSU shouldnt change Serial.println(sensorValue); int sv = analogRead(A1); trans = (lim - (sv/40)); if(sensorValue < 100){ myservo.write(minx); } else{ myservo.write(trans); } if(sensorValue > 1000){ // its done drawing, and out of range anyways myservo.write(30); // go back to neutral position delay(300); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)