sandeepmistry / arduino-nRF5

Arduino Core for Nordic Semiconductor nRF5 based boards
Other
872 stars 278 forks source link

adds Calliope mini V3 to the library #518

Closed fabianhugo closed 6 months ago

fabianhugo commented 6 months ago

Dear Sandeep Mistry, thank you a lot for your great work! this Pull Request adds the Calliope mini as a NRF52833 device to the NRF5 Arduino library. The Calliope mini 3 is partly based on the micro:bit v2 for best compatibility with IDEs and software frameworks. So big parts of the pinout is completely equivalent to the micro:bit v2 as well as the DAPLink PID and VID, but additional pins have been added for the support of:

The following code can be used to test the new functions:

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(3, PIN_RGB, NEO_GRB + NEO_KHZ800);

void setup() {
  // put your setup code here, to run once:
  // Set up serial connection
  Serial.begin(9600);
  Serial.println("Hi!");

  // Set up Buttons
  pinMode(PIN_BUTTON_A, INPUT);  
  pinMode(PIN_BUTTON_B, INPUT);  

  // Set up 3 internal RGB lights
  pixels.begin();
  pixels.setPixelColor(0, pixels.Color(50, 0, 50)); // red + blue   = magenta
  pixels.setPixelColor(1, pixels.Color(50, 50, 0)); // red + green  = yellow
  pixels.setPixelColor(2, pixels.Color(0, 50, 50)); // green + blue = cyan
  pixels.show(); // Initialize all pixels to 'off'

  // Set up motor driver
  pinMode(PIN_M_MODE, OUTPUT); 
  pinMode(PIN_M0_DIR, OUTPUT); 
  pinMode(PIN_M0_SPEED, OUTPUT);
  pinMode(PIN_M1_DIR, OUTPUT);
  pinMode(PIN_M1_SPEED, OUTPUT);
  digitalWrite(PIN_M_MODE, 1); // Sets motor driver into correct mode (PHASE/ENABLE)
  digitalWrite(PIN_M0_DIR, 0); // Sets motor M0 into forward direction 
  analogWrite(PIN_M0_SPEED, 200); //Sets speed of M0 to 200/1024
  digitalWrite(PIN_M1_DIR, 1); // Sets motor M0 into backward direction 
  analogWrite(PIN_M1_SPEED, 200); // Sets speed of M1 to 200/1024
}

void loop() {
  // put your main code here, to run repeatedly:

  if (! digitalRead(PIN_BUTTON_A)) 
  {
    Serial.println("Button A pressed");
    analogWrite(PIN_M0_SPEED, 500); // Raise speed to 500/1024
    analogWrite(PIN_M1_SPEED, 500); // Raise speed to 500/1024
    pixels.setPixelColor(1, pixels.Color(0, 50, 0)); pixels.show();
  }
  if (! digitalRead(PIN_BUTTON_B)) 
  {
    Serial.println("Button B pressed");
    analogWrite(PIN_M0_SPEED, 0); // Turn off motor
    analogWrite(PIN_M1_SPEED, 0); // Turn off motor
    pixels.setPixelColor(1, pixels.Color(0, 0, 0)); pixels.show();
  }
  delay(150);
}
sandeepmistry commented 6 months ago

@fabianhugo thanks for opening this pull request, overall things look good!

A few questions/comments:

fabianhugo commented 6 months ago

great, thanks for the feedback. I updated the branch to include the mini V3 in the Github action. you can find the schematic here The following 2 pictures show excerpts of the wiring of the nRF52833 and the pin header: grafik grafik Let me know if you have further questions.

sandeepmistry commented 6 months ago

@fabianhugo thank you!

fabianhugo commented 6 months ago

Thank you too! It still needs to be included in a new release and to adapt the json file, to be able to use it right?

fabianhugo commented 6 months ago

@sandeepmistry Have you had time to look into this?

Thank you too! It still needs to be included in a new release and to adapt the json file, to be able to use it right?

sandeepmistry commented 5 months ago

@fabianhugo I've tagged a new 0.8.0 release and updated the docs/package_nRF5_boards_index.json for the new release.