Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds Calliope mini V3 to the library #518

Merged
merged 4 commits into from
Dec 20, 2023

Conversation

fabianhugo
Copy link
Contributor

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:

  • 3 internal RGB leds,
  • touch pad 3, the
  • analog input of the grove connector
  • motor driver.
    On this link you can find additional info.
    I touched the following files:
  • README.md
  • boards.txt
  • variants/CalliopeminiV3/pins_arduino.h
  • variants/CalliopeminiV3/variant.cpp
  • variants/CalliopeminiV3/variant.h
    The .json file probably still needs to be adapted: https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json

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
Copy link
Owner

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

A few questions/comments:

@fabianhugo
Copy link
Contributor Author

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 sandeepmistry merged commit fbbcccb into sandeepmistry:master Dec 20, 2023
29 checks passed
@sandeepmistry
Copy link
Owner

@fabianhugo thank you!

@fabianhugo
Copy link
Contributor Author

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
Copy link
Contributor Author

@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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants