Super Simple RTC

Post your cool example code here.
User avatar
RogerClark
Posts: 5595
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Super Simple RTC

Postby RogerClark » Mon Sep 26, 2016 9:23 pm

See https://www.youtube.com/watch?v=SBHyQ1OSM-4

I recommend the ID107HR as it has touch button on the front as well as a real button on the side. I paid around $18 USD including postage, (on AliExpress)

Just make sure the description includes nRF51822 as a lot of these are miss-sold.


I have everything working on it except the heart rate detection

User avatar
mrburnette
Posts: 1779
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Super Simple RTC

Postby mrburnette » Sat Oct 01, 2016 6:08 pm

neo2121 wrote:No extra libraries are required, just the RTClock library that comes with stm32duino.

From some of my example stuff from the dark ages of STM32... modified today to work with the Blue Pill. The example just counts seconds...

Code: Select all

/*
  Using library RTClock at version 1.0 in folder: /home/ray/Arduino/hardware/Arduino_STM32-TMRPCM-and-example-/STM32F1/libraries/RTClock
  Linux Mint 17.3 64-bit ArduinoGUI 1.6.11
    Sketch uses 18,436 bytes (14%) of program storage space. Maximum is 131,072 bytes.
    Global variables use 3,904 bytes of dynamic memory.
 */

#include <RTClock.h>

RTClock rt (RTCSEL_LSE);            // initialise clock object
uint32 tt;

#define LED_PIN PC13                // Blueboard

// This function is called in the attachSecondsInterrpt
void blink ()
{
 digitalWrite(LED_PIN,!digitalRead(LED_PIN));
}

void setup()
{
  Serial.begin(19200);
  pinMode(LED_PIN, OUTPUT);
  delay(1000);
  Serial.println("Initializing... \n\r");
  rt.attachSecondsInterrupt(blink); // Call blink @ 1 second intervals
}

void loop()
{
 
  if (rt.getTime()!=tt)             // do nothing while seconds are ==
  {
    tt = rt.getTime();              // update to new second count
   
    Serial.print("seconds count is: ");
    Serial.println(tt);             // tell Operator the second count
  }
}

simonliu009
Posts: 1
Joined: Sun Mar 26, 2017 2:51 am

Re: Super Simple RTC

Postby simonliu009 » Sun Mar 26, 2017 2:57 am

wow, thank you very much for this.
:D


Return to “Code snipplets”

Who is online

Users browsing this forum: No registered users and 1 guest