Skip to content

Commit

Permalink
Main QuickShift Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
WonITKorea committed Aug 30, 2024
1 parent e86d807 commit 9d0a0f3
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions code/SKIDAQ_Main/SKIDAQ_Main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Adafruit_ADS1115 ads; /* ADS1115 - 16-bit version */

RtcDS3231<TwoWire> Rtc(Wire);

#define DynoPin 9
#define MOSUP_PIN 12
#define MOSDOWN_PIN 13

char picoTemp = analogReadTemp(); // Pi Pico On-Board Temp Sensor
int obled = LED_BUILTIN; // On-Board LED for Basic Error Indication

Expand All @@ -30,20 +34,19 @@ void ADXL345_displaySensorDetails(void);
void ADXL345_displayDataRate(void);
void ADXL345_displayRange(void);
void MCP2515_Init(void);

void upShiftFunc(void);
void downShiftFunc(void);
void blink(int deltime);

#define DynoInt 9
#define MOSUP_PIN 12
#define MOSDOWN_PIN 13


void setup()
{
delay(2000);
pinMode(obled, OUTPUT);
pinMode(MOSUP_PIN, OUTPUT);
pinMode(MOSDOWN_PIN, OUTPUT);
pinMode(DynoInt, OUTPUT);
pinMode(DynoPin, OUTPUT);
Serial.begin(115200);
while (!Serial)
{
Expand All @@ -52,6 +55,7 @@ void setup()
ADS1115_Init();
ADXL345_Init();
MCP2515_Init();
digitalWrite(DynoPin, LOW);
blink(1000);
delay(1000);
}
Expand Down Expand Up @@ -253,6 +257,22 @@ void MCP2515_Init(void)
Serial.println("CAN Status: OK");
}

void upShiftFunc(int time) {
digitalWrite(MOSUP_PIN, HIGH);
digitalWrite(DynoPin, HIGH);
delay(time);
digitalWrite(MOSUP_PIN, LOW);
digitalWrite(DynoPin, LOW);
}

void downShiftFunc(int time) {
digitalWrite(MOSDOWN_PIN, HIGH);
digitalWrite(DynoPin, HIGH);
delay(time);
digitalWrite(MOSDOWN_PIN, LOW);
digitalWrite(DynoPin, LOW);
}

void blink(int deltime)
{
digitalWrite(LED_BUILTIN, HIGH);
Expand Down

0 comments on commit 9d0a0f3

Please sign in to comment.