• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Shares 0
    • Posts 4
    • Groups 0
    J Offline
    1. Home
    2. Jelle
    3. Topics

    Topics

    • J

      Interfase trouble with the raspberry pi 3 (Analog output)

      Watching Ignoring Scheduled Pinned Locked Moved Unipi 1 - First Generation
      3
      0 Votes
      3 Posts
      2k Views
      J
      I use the wiringPi library so to run this code you should install wiringPi #include <stdio.h> #include <unistd.h> #include <stdint.h> #include "wiringPi.h" void gpioSetupCostum() { printf("gpioSetup has started\n"); wiringPiSetupGpio (); usleep(1000); printf("wiringPiSetupGpio was a succes\n"); pinMode(18, PWM_OUTPUT); usleep(1000); printf("pinMode was a succes\n"); pwmSetMode(PWM_MODE_MS); usleep(1000); printf("pwmSetMode was a succes\n"); pwmSetRange(1024); usleep(1000); printf("pwmSetRange was a succes\n"); pwmSetClock(47); usleep(1000); printf("pwmSetClock was a succes\n"); } void gpioClose() { pwmSetMode(PWM_MODE_BAL); usleep(1000); pinMode(18, INPUT); usleep(1000); } int main() { int GPIOCounter, SampleCounter; double PWM[11]={0, 1 , 2 , 3, 4, 5, 6, 7, 8, 9, 10}; const int len = 11; int AmountOfSamples = 200; printf("Start setup\n"); gpioSetupCostum(); printf("Finish setup\n"); printf("Start reading input ports\n"); for(SampleCounter =1; SampleCounter <= AmountOfSamples; SampleCounter++){ printf("Sample = %d\n", SampleCounter); for(GPIOCounter = 0; GPIOCounter < len; GPIOCounter++){ printf("PWM input = %.1f\n", PWM[GPIOCounter]); pwmWrite(18, (int)((PWM[GPIOCounter] * 1024)/10)); usleep(1000000); } } gpioClose(); }
    • J

      Interfase trouble with the raspberry pi 3 (Digital inputs)

      Watching Ignoring Scheduled Pinned Locked Moved Unipi 1 - First Generation
      4
      0 Votes
      4 Posts
      2k Views
      T
      @jelle the levels can be different if you configure the jumpers to use different power supply, if you are using the onboard 12, then the GNDs are on the same level