/** * Vending machine with cookies * * Author: Jan Dvořák z Vozerovic * E-mail: dvorkaman@gmail.com * Web: dvorkaman.asp2.cz * Created: 2015 - 2016 */ /* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "stm32f4xx.h" #include "libSystem.h" #include "libSystemTime.h" #include "libXbeeApi.h" #include "libF4mini.h" #include "libUSART.h" #include "libPWMTone.h" #include "libUtils.h" #include "libSensors.h" #include "libSwitch.h" #include "libPrinter.h" #define BELT_SPEED 75 // % #define BELT_MOVE_TIME 1000 // ms #define BELT_SAME_MOVE_TIME 850 // ms #define SERVO_MOVE_TIME 320 // ms #define UP_MIN 40 #define UP_MID 90 #define UP_MAX 140 #define DOWN_MIN 50 #define DOWN_MID 100 #define DOWN_MAX 150 #define COIN_MIN 35 #define COIN_MAX 152 #define DOOR_MIN 4 #define DOOR_MAX 180 void initializePeripherals(void); void clearPeripherals(void); void readInputs(void); void selectBelt(uint8_t number); // 0 = none; 1 = left top, 2 = right top; 3 = left botom, 4 = right bottom void runMotor(uint8_t beltNumber); void moveBelt(uint8_t beltNumber); void setLights(void); void evaluateIrSensor(BitAction value); void finishOrder(void);