Comments (5)
The library only generates PWM signal.
How your motor moves completely depends on the motor you're using.
First check your motor(what kind of motor, model, etc) and check the data sheet of it.
from jetsongpio.
I thought it might be something to do with the 'high' and 'low'.
I'm pretty sure it is a software option to change the direction of the motor. On a Raspberry Pi and Arduino IDE I can change the direction with code.
from jetsongpio.
There's no direction in pwm signal. Just frequency and duty cycle.
https://www.analogictips.com/pulse-width-modulation-pwm/
Can you give more details?
What Jetson device are you using?
What kind of motor are you using? (Servo, dc, step, etc)
Motor model?
How do you setup the circuit?
from jetsongpio.
You're probably the most responsive repo owner on GitHub.
Nvidia Jetson AGX Xavier.
Nema 17 motor.
Driver is a Usongshine Stepper Motor Driver TB6600 4A 9-42V
I was just thinking about how I might need to change something with the driver's wiring.
I don't know how to wire it up. Right now I just have a wire in pull+ to the PWM pin and the pull- to the ground pin.
from jetsongpio.
Okay, I got the motor running clockwise and then counterclockwise with the code below.
I also wired the driver differently. For the signal pins on the driver, all the + sockets are connected to each other and connected to my Jetson's 5V output.
The signal's dir - is connected to my pin 15.
The signal's pul - is connected to my pin 18.
#include <iostream>
// for delay function.
#include <chrono>
#include <map>
#include <string>
#include <thread>
// for signal handling
#include <signal.h>
#include <JetsonGPIO.h>
using namespace std;
inline void delay(int s) { this_thread::sleep_for(chrono::seconds(s)); }
static bool end_this_program = false;
void signalHandler(int s) { end_this_program = true; }
int main()
{
// Pin Definitions
int output_pin = 18;
int direction_pin = 15;
// When CTRL+C pressed, signalHandler will be called
signal(SIGINT, signalHandler);
// Pin Setup.
// Board pin-numbering scheme
GPIO::setmode(GPIO::BOARD);
// set pin as an output pin with optional initial state of HIGH
GPIO::setup(output_pin, GPIO::OUT, GPIO::HIGH);
GPIO::PWM p(output_pin, 200);
GPIO::setup(direction_pin, GPIO::OUT, GPIO::LOW);
GPIO::PWM e(direction_pin, 200);
auto val = 75.0;
e.start(val);
p.start(val);
cout << "PWM running. Press CTRL+C to exit." << endl;
for (int i = 0; i < 4; i++){
delay(1);
cout << 1;
}
e.stop();
for (int i = 0; i < 4; i++){
delay(1);
cout << 1;
}
p.stop();
GPIO::cleanup();
return 0;
}
from jetsongpio.
Related Issues (20)
- Improve PWM part of the API document
- GPIO::remove_edge_detect function: add warning for no event found HOT 1
- Update sysfs pwm dir
- Add more sample codes
- Add prerequisites info to the installation guide HOT 1
- Add pre-built binaries to release page
- How to control Rx, Tx pin on Jetson Nano? HOT 1
- orin nano run error HOT 1
- No support for PQ.02 for Jetson Orin NX
- Jetson Orin Nano: cannot find GPIO chip 2200000.gpio HOT 11
- Jetson Orin GPIO Chip cannot find Jetpack 6
- Support for Jetson Orin NX
- Support for Nano and Xavier NX HOT 2
- Error compiling with CmakeLists HOT 4
- "When importing both JetsonGPIO.h and cuda_runtime.h at the same time, a compilation error occurs." HOT 4
- Docker Image CI fails HOT 1
- Can I reboot the nano system through GPIO? HOT 1
- Adding Compat models for Jetson Orin HOT 3
- Move to gpio character device implementation HOT 1
- Divide README into multiple documents for readability
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetsongpio.