Jump to content

Ross

  • Posts

    127
  • Joined

  • Days Won

    8

Ross last won the day on September 21 2021

Ross had the most liked content!

2 Followers

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Ross's Achievements

Εξερευνητής

Εξερευνητής (3/13)

  • Five Years In
  • Reacting Well
  • Dedicated 1 Month
  • Dedicated 2 Weeks
  • 10th Layout Released Rare

Recent Badges

552

Reputation

  1. Version 1.0.0

    465 downloads

    5p, 10p and 25p £5, £8 TK, £10 and £15
  2. here is what i tried, note i don't use c++ often (blue moon level rareness but the main idea is you need a switch statement) i added a suffix of '//++'.to lines changed by me so you can see what im trying. note: i assumed the pulses sent is in increments of 1000, if this is wrong you will need to change each case to the correct pulse count expected for that note as well as the 'min_cost_of_service' and 'max_cost_of_service' (min_cost_of_service = pulse count for £5 and max_cost_of_service = £50) #include <Keyboard.h> /* This program expects pulses of logic high coming from a bill acceptor into pin 0 on an arduino leonardo. It counts the number of pulses, pretends to be a usb keyboard and sends an F3 keypress when enough total pulses have been received to pay for a service. */ // The pin on the arduino where CREDIT (-) [Common] is connected #define INPIN (9) int cents_per_pulse; // how many cents per pulse. for most bill acceptors this is 100 or $1 per pulse, but it can often be configured and coin acceptors will be different int min_pulse_width; // the minimum pulse width to acccept int max_pulse_width; // the maximum pulse width to accept int debounce_speed; // ignore changes in input line state that happen faster than this int pulse_count; // how many pulses have been received so far in this pulse train //int cents_received; // Counts how many cents have been received//++ int cost_of_service; // Trigger service when this number of cents have been received unsigned long pulse_duration; // how long was the last pulse unsigned long pulse_begin; // when did the last pulse begin unsigned long pulse_end; // if they pulse was within min and max pulse width, when did it end unsigned long curtime; // what is the current time int post_pulse_pause; // how long to wait after last pulse before sending pulse count int pulse_state; // what is the current input line state (1 for high, 0 for low) int last_state; // what was the last input line state int min_cost_of_service; // Trigger service when this minimal number of cents have been received. //++ int max_cost_of_service; //++ void setup() { pinMode(INPIN, INPUT); // Pin 0 is the pin where the pulse output from the bill acceptor is connected. Change it // Serial.begin(115200); // You can comment all the Keyboard lines and uncomment all the serial lines to make it print to serial instead (useful for debugging) Keyboard.begin(); pulse_begin = 0; last_state = 0; min_pulse_width = 40; max_pulse_width = 60; debounce_speed = 4; post_pulse_pause = 300; cents_per_pulse = 100; pulse_end = 0; pulse_count = 0; //cents_received = 0;//++ cost_of_service = 1000; min_cost_of_service = 1000; //++ max_cost_of_service = 4000; } void loop() { pulse_state = digitalRead(INPIN); curtime = millis(); if((pulse_state == 1) && (last_state == 0)) { // this means we entered a new pulse pulse_begin = curtime; // save the begin time of the pulse last_state = 1; // set the previous state } else if((pulse_state == 0) && (last_state == 1)) { // this means a pulse just ended pulse_duration = curtime - pulse_begin; // calculate pulse duration if(pulse_duration > debounce_speed) { // ensure that we don't change state for very short (false) pulses (this is called debouncing) last_state = 0; } if((pulse_duration > min_pulse_width) && (pulse_duration < max_pulse_width)) { // check if the pulse width is between the minimum and maximum pulse_end = curtime; // save the end time of the pulse pulse_count++; // increment the pulse counter } } if((pulse_end > 0) && (curtime - pulse_end > post_pulse_pause)) { // check if we've waited long enough that we don't expect any further pulses to be forthcoming //cents_received += pulse_count * cents_per_pulse;//++ //if(cents_received >= cost_of_service) { // check if enough money has been paid for the service//++ if(pulse_count >= min_cost_of_service && pulse_count <= max_cost_of_service) {//++ // Serial.print(pulse_count); // Serial.println(); //Keyboard.write('z'); // Send a z keypress//++ switch(pulse_count) { //++ case 1000: //++ // £5, 1000 pulses. //++ Keyboard.write('a'); //++ break; //++ case 2000: //++ // £10 2000 pulses. //++ Keyboard.write('b'); //++ break; //++ case 3000: //++ // £20 3000 pulses. //++ Keyboard.write('c'); //++ break; //++ case 4000: //++ // £50 4000 pulses. //++ Keyboard.write('d'); //++ break; //++ } //cents_received = 0; // reset cents_received so it's ready for next payment//++ } pulse_end = 0; pulse_count = 0; } }
  3. Version 1.0.0

    152 downloads

    With thanks to: @andy-1 for the base layout and real machine questions. @Tommy c for his font id help. and Chris a.k.a Wizard.
  4. Version 1.0.0

    282 downloads

    With thanks to Chris a.k.a Wizard.
  5. Appreciate the comment but that was a design choice.
  6. Version 1.0.0

    236 downloads

    With thanks to Chris aka Wizard.
  7. Version 1.0.3

    172 downloads

    With thanks to Chris aka Wizard.
  8. This one is for Chris, truly the saddest time we have had to face as a community. R.I.P Chris and again thanks for all you did for us.
  9. Ross

    The Saddest Day

    Only just heard the news truly devastating, MFME like most of us has been apart of my daily routine for years and has brought me many thousands of hours of joy re living my younger days. thanks for everything you did Chris. R.I.P
  10. Version 1.0.2

    175 downloads

    With thanks to @Reg for the tech help.
  11. ive been dragging my feet with the release as the base art used was bad to say the least and so the layout is not good. i might upload later today if i get time to prepare the layout for release.
  12. Version 1.0.0

    280 downloads

    £5, £8 and £25 layouts.
  13. if your using the g540
  14. Version 1.0.0

    51 downloads

    Classic.
×
×
  • Create New...