Hello,
I’m a bit confused on setting up the input and output pins. First thing I am trying to do is configure a 12V output pin with a pwm signal to simulate a speed sensor signal. Using the M2_12VIO library, I believe the following short lines of code are all I need to set the pin at a 100hz, 50% duty cycle.
// Required libraries
#include “variant.h”
#include <M2_12VIO.h>
#include <pins_arduino.h>
#include <Arduino.h>
#include “M2_IO.h”
#include <pwm_lib.h>
M2_12VIO M2IO;void setup() {
M2IO.Init_12VIO(); // Initialize the M2I/O library
M2IO.Setpin_12VIO(2, ON, SOURCE, PWM_PIN, 100, 50);
}
void loop() {
}
Or am I missing something here? I don’t seem to be getting it to work like I would expect…
And the next thing I am trying to do is read a switch. Can the 12V input pins be configured as input pullup? Other end of the switch is connected to ground. Would I be using the following functions for this, if my switch is connected to input 2?
InitButton_12VIO(2);
GetButton_12VIO(2);
Sorry for the basic questions, I’m still learning Arduino as I go.