r/Arduino_AI • • Dec 03 '25

Code Help Arduino help Request - Zeppelin

1 Upvotes

Hello,

I'm in desperate need of help with lines of code for my Arduino project.

I'm making a RC Zeppelin with 3 BLDC Motors, 2 for direction on each side of the zeppelin, 1 for elevation under the zeppelin. We are also using 3 ESC + BLDCS Pulsar B-20. We are using the receiver R8EF and as sensors the BMP280 + InduinoST1099 and a T8S Controller.

We are also using the Arduino nano.

What I'm requesting is basic lines of code to make my Zeppelin up and working in Arduino.

Thanks for your time and many thanks!


r/Arduino_AI • • Oct 05 '25

Arduino Nano/usb host shield/dot matrix display/keyboard

1 Upvotes

I’m working on a project that sends a scrolling message to an 8 module dot matrix display (I got this part to work) and then change the message with a keyboard after pressing enter (not working)

I’ve been going back and forth with ChatGPT trying to get this to work but no luck. It appears that both the scrolling and keyboard are fighting each other , they work independently but not together.

Is this even doable?


r/Arduino_AI • • Aug 08 '25

Bluetooth not working on my Nano 33 BLE sense board

1 Upvotes

Hi everyone, I have a nano 33BLE sense board which I was using to do gesture detection. While use the dataset generated by other people, everything worked fine, and the board was fully working.

However, to generate my own dataset, I tried to connect via bluetooth to my computer, as that is a requirement of chrome web bluetooth, which is the site Im using to get my data. Whenever I try to connect bluetooth, it always says "BLE sense has been disconnected" on the web bluetooth, and it says Not connected on my default computer bluetooth.

I have installed the bluetooth library version 1.4.1, which is the most up to date version (and I tried unistalling and reinstalling it)

Any help would be greately apprecaited

TLDR: my bluetooth on my Nano 33 BLE sense board is not working properly, and Im not sure how to fix it


r/Arduino_AI • • Mar 30 '25

Newbie lf project recommendations

1 Upvotes

Hi all. I am looking for your recommendations for my first arduino project we're going to buy one for my birthday. I figured this might be the best place to ask.

I love to make things that are practical, and I also love robots and AI (I want to eventually make my own little bot like an Emo.)

My skills thus far: I know some Python, and a tiny bit of C, Java, and html/css. I have built my own desktop, upgraded my laptop's hardware, and installed different Linux distros over the years so I'm familiar with Unix. I've never soldered a thing, but I have a soldering kit and a steady hand. I have virtually no electricity knowledge beyond how to jumpstart a car and how to not flip my breakers, despite taking a physics class and a lighting class 😅 Ohm's law doesn't like to stick in my brain.

My interests: friendly cute robots, AI, cyberpunk, mechanical motion, automation of plant care (lights, watering) and automation of environmental spaces like how thermostats have sensors to keep a room at the right temperature. I have many sensors in my living space for air quality, humidity, and temperature due to an allergy disability. I've been wanting to create an algae oxygen maker, but I don't have the time to look after it frequently (I already have so many devices I need to upkeep so that I'm healthy) so I'd need to automate it's care somehow.

If there's a project out there that could fit at least some of these traits, please let me know. I am very new to this, and I want a kit because I'm tired of trying to pioneer my own learning only to find myself in way over my head. Thanks!


r/Arduino_AI • • Mar 04 '25

Look What I Made! A New Game Using the Minimax Library – Othello (Reversi)!

Thumbnail reddit.com
1 Upvotes

r/Arduino_AI • • Mar 03 '25

Look What I Made! Starting a New Templated Minimax Library w/example Checkers.ino Sketch

1 Upvotes

Hi all. As most everybody knows I love the craft and art of coding, reuse, and using the minimax algorithm (with alpha-beta narrowing) to make turn-based Arduino games that can play themselves or a human.

This was explored in the MicroChess project that was chronicled here last year. Ever since I wrote that 5th or 6th version (I used it in all of my chess engines regardless of the language including java and javascript), I've wanted to write a wrapper class that allows anyone to make any kind of turn based game and make use of the same library to supply the brains behind the Arduino side for any game anyone wanted to make.

For those that don't know about the algorithm I highly suggest reading the wikipedia article on it or other articles.

The name "minimax" comes from the idea that you are trying to minimize your opponent's score while also attempting to maximize your own score. Another name is the maximin algorithm just wording it differently.

The algorithm is recursive and allows you to let each side examine all moves, pick the best one, make the move temporarily, and hen switch side and make the best move in reaction by the opponent. This would be known as a ply depth of 2 because we made one move and then we let the other side make a move, and tested that for every move we had, picking the move that left us with the best board value for our side.

Testing for each side having a move before picking the best move is also known as a "full ply" because neither side has a move advantage when we evaluate the board state that might trick us into thinking a move is better than it really is.

Because each ply basically expands the search space to be 'our number of moves' ^ 'their number of moves'. This gets exponentially larger with each ply depth and takes exponentially longer! To help make the search space as small as possible we use something extra to constrain what we consider our "best-worst move", and we don't search any deeper for moves that are worse than this. That's the "Alpha" side constraint. We also do this for the "best-worst move" that our opponent can make. And we assume that if the opponent played their best game, that they wouldn't make any moves worse than this if they played perfectly. So we rule out searching any deeper on any moves moves on their side that are worse than this value. That is the "Beta" side constraint.

Alpha-Beta pruning/culling/narrowing, is the basic idea that, as we explore the various moves that we can make we keep track of our worst and best moves, as well as those of our opponent. This keeps us from evaluating hundreds of thousands of moves and saving tons of time to pick our best move.

I've always giggled at how well this algorithm actually works on the ATmega328 even with only 2K of RAM. If structured correctly you can get up to 5, 6, or even 7 plies deep. The ESP32 can go much much deeper and faster too!

What follows is a game-independent, fully templated set of minimax game classes in Minimax.h that will work for any turn based game such as chess, checkers, and tons of other Arduino "Smart" games, following by a fully working Checkers.ino game that makes use of the base (eventual) library code and classes. The game lets you choose between Human vs AI, or AI vs AI when the game starts.

Have Fun!

Example Serial window output:

Nodes searched: 3
Time: 0.00 seconds
    0  1  2  3  4  5  6  7 
  +------------------------+
0 | .  b  .  b  .  b  .  b |
1 | b  .  b  .  b  .  b  . |
2 | .     .  w  .     .  b |
3 |    .  b  .     .  b  . |
4 | .     .  w  .     .    |
5 | w  .     .  w  .     . |
6 | .  w  .  w  .  w  .  w |
7 | w  .  w  .  w  .  w  . |
  +------------------------+
Black's turn
AI is thinking...
AI move: 1,2 to 3,4
Nodes searched: 16
Time: 0.01 seconds

Minimax.h

/**
 * @file Minimax.h
 * @brief A templated Minimax algorithm implementation for Arduino with alpha-beta pruning
 * 
 * This library implements the minimax algorithm for two-player turn-based games
 * while respecting Arduino constraints: 32K flash limit, no STL, and avoiding
 * dynamic memory allocation. Stack based composition and instantiation is fine
 * as long as we eventually calculate the impact per recursive call and try to
 * make that as small as possible, so we can examine deeper ply depths.
 * 
 * March 2, 2025 ++tmw
 * 
 */

#ifndef MINIMAX_H
#define MINIMAX_H

#include <Arduino.h>

/**
 * @brief The core Minimax algorithm implementation with alpha-beta pruning
 * 
 * @tparam GameState Type representing the game state (board, positions, etc.)
 * @tparam Move Type representing a valid move in the game
 * @tparam MaxMoves Maximum number of possible moves to consider at any position
 * @tparam MaxDepth Maximum search depth for the algorithm
 */
template <typename GameState, typename Move, int MaxMoves = 64, int MaxDepth = 5>
class Minimax {
public:
    /**
     * @brief Game-specific logic interface that must be implemented by the user
     */
    class GameLogic {
    public:
        /**
         * @brief Evaluate a game state from current player's perspective
         * Higher values indicate better positions for the current player
         */
        virtual int evaluate(const GameState& state) = 0;
        
        /**
         * @brief Generate all valid moves from the current state
         * @return Number of moves generated
         */
        virtual int generateMoves(const GameState& state, Move moves[], int maxMoves) = 0;
        
        /**
         * @brief Apply a move to a state, modifying the state
         */
        virtual void applyMove(GameState& state, const Move& move) = 0;
        
        /**
         * @brief Check if the game has reached a terminal state (win/loss/draw)
         */
        virtual bool isTerminal(const GameState& state) = 0;
        
        /**
         * @brief Check if the current player is the maximizing player
         * Typically alternates between players in turn-based games
         */
        virtual bool isMaximizingPlayer(const GameState& state) = 0;
    };
    
    /**
     * @brief Constructor
     * @param logic Game-specific logic implementation
     */
    Minimax(GameLogic& logic) : _logic(logic), _nodesSearched(0) {}
    
    /**
     * @brief Find the best move for the current game state
     */
    Move findBestMove(const GameState& state) {
        Move bestMove;
        Move moves[MaxMoves];
        int moveCount = _logic.generateMoves(state, moves, MaxMoves);
        
        if (moveCount == 0) {
            return bestMove; // No moves available
        }
        
        bool isMax = _logic.isMaximizingPlayer(state);
        _bestScore = isMax ? -32000 : 32000;
        _nodesSearched = 0;
        
        for (int i = 0; i < moveCount; i++) {
            GameState newState = state;
            _logic.applyMove(newState, moves[i]);
            
            int score = minimax(newState, MaxDepth - 1, -32000, 32000, !isMax);
            
            if (isMax) {
                if (score > _bestScore) {
                    _bestScore = score;
                    bestMove = moves[i];
                }
            } else {
                if (score < _bestScore) {
                    _bestScore = score;
                    bestMove = moves[i];
                }
            }
        }
        
        return bestMove;
    }
    
    /**
     * @brief Get the score of the best move 
     */
    int getBestScore() const { return _bestScore; }
    
    /**
     * @brief Get the number of nodes searched (for performance analysis)
     */
    int getNodesSearched() const { return _nodesSearched; }
    
private:
    GameLogic& _logic;
    int _bestScore;
    int _nodesSearched;
    
    /**
     * @brief The minimax algorithm with alpha-beta pruning
     */
    int minimax(const GameState& state, int depth, int alpha, int beta, bool maximizingPlayer) {
        _nodesSearched++;
        
        if (depth == 0 || _logic.isTerminal(state)) {
            return _logic.evaluate(state);
        }
        
        Move moves[MaxMoves];
        int moveCount = _logic.generateMoves(state, moves, MaxMoves);
        
        if (maximizingPlayer) {
            int maxEval = -32000;
            for (int i = 0; i < moveCount; i++) {
                GameState newState = state;
                _logic.applyMove(newState, moves[i]);
                int eval = minimax(newState, depth - 1, alpha, beta, false);
                
                maxEval = max(maxEval, eval);
                alpha = max(alpha, eval);
                if (beta <= alpha) {
                    break; // Beta cutoff
                }
            }
            return maxEval;
        } else {
            int minEval = 32000;
            for (int i = 0; i < moveCount; i++) {
                GameState newState = state;
                _logic.applyMove(newState, moves[i]);
                int eval = minimax(newState, depth - 1, alpha, beta, true);
                
                minEval = min(minEval, eval);
                beta = min(beta, eval);
                if (beta <= alpha) {
                    break; // Alpha cutoff
                }
            }
            return minEval;
        }
    }
};

#endif // MINIMAX_H

Checkers.ino

/**
 * Checkers.ino - Checkers game implementation using Minimax library
 * 
 * This sketch implements a checkers game that can be played:
 * - Human vs. AI
 * - AI vs. AI (self-play)
 * 
 * The game interface uses Serial communication for display and input.
 * 
 * March 2, 2025 ++tmw
 */

#include "Minimax.h"

// Constants for board representation
#define   EMPTY          0
#define   WHITE          1
#define   BLACK          2
#define   WHITE_KING     3
#define   BLACK_KING     4

// Game configuration
#define   MINIMAX_DEPTH  2   // AI search depth - can go to ~5 before stack issues
                             // NOTE that the time per moves goes up exponentially
                             // per ply depth. In future articles I can help this.
#define   MAX_MOVES     40   // Maximum possible moves for one position

// Board size
#define   BOARD_SIZE     8

// Game modes
#define MODE_HUMAN_VS_AI 0
#define MODE_AI_VS_AI    1

// Game state - represents the board
struct CheckersState {
  byte board[BOARD_SIZE][BOARD_SIZE];
  bool blackTurn;  // true if it's black's turn, false for white's turn
  
  // Initialize the board with starting position
  void init() {
    blackTurn = false;  // White goes first
    
    // Initialize empty board
    for (int row = 0; row < BOARD_SIZE; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        board[row][col] = EMPTY;
      }
    }
    
    // Set up black pieces (top of board)
    for (int row = 0; row < 3; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        if ((row + col) % 2 == 1) {  // Only on black squares
          board[row][col] = BLACK;
        }
      }
    }
    
    // Set up white pieces (bottom of board)
    for (int row = 5; row < BOARD_SIZE; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        if ((row + col) % 2 == 1) {  // Only on black squares
          board[row][col] = WHITE;
        }
      }
    }
  }
};

// Move structure
struct CheckersMove {
  byte fromRow, fromCol;
  byte toRow, toCol;
  bool isJump;  // true if this move captures a piece
  byte jumpRow, jumpCol;  // position of captured piece if isJump is true
  
  CheckersMove() : fromRow(0), fromCol(0), toRow(0), toCol(0), isJump(false), jumpRow(0), jumpCol(0) {}
  
  CheckersMove(byte fr, byte fc, byte tr, byte tc) 
    : fromRow(fr), fromCol(fc), toRow(tr), toCol(tc), isJump(false), jumpRow(0), jumpCol(0) {
    // Calculate if this is a jump move
    if (abs(tr - fr) == 2) {
      isJump = true;
      jumpRow = (fr + tr) / 2;
      jumpCol = (fc + tc) / 2;
    }
  }
};

// Game logic implementation
class CheckersLogic : public Minimax<CheckersState, CheckersMove, MAX_MOVES, MINIMAX_DEPTH>::GameLogic {
public:
  // Evaluate board position from current player's perspective
  int evaluate(const CheckersState& state) override {
    int score = 0;
    
    // Count material difference (pieces and kings)
    for (int row = 0; row < BOARD_SIZE; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        switch (state.board[row][col]) {
          case WHITE:
            score += 100;
            break;
          case BLACK:
            score -= 100;
            break;
          case WHITE_KING:
            score += 200;
            break;
          case BLACK_KING:
            score -= 200;
            break;
        }
      }
    }
    
    // Positional evaluation (favor advancement and center control)
    for (int row = 0; row < BOARD_SIZE; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        if (state.board[row][col] == WHITE) {
          // Encourage white pieces to advance
          score += (BOARD_SIZE - 1 - row) * 5;
          // Favor center control
          if (col > 1 && col < 6 && row > 1 && row < 6) {
            score += 10;
          }
        } 
        else if (state.board[row][col] == BLACK) {
          // Encourage black pieces to advance
          score -= row * 5;
          // Favor center control
          if (col > 1 && col < 6 && row > 1 && row < 6) {
            score -= 10;
          }
        }
      }
    }
    
    // Invert score if it's black's turn (since we're using perspective of current player)
    return state.blackTurn ? -score : score;
  }
  
  // Generate all valid moves from the current state
  int generateMoves(const CheckersState& state, CheckersMove moves[], int maxMoves) override {
    int moveCount = 0;
    byte player = state.blackTurn ? BLACK : WHITE;
    byte king = state.blackTurn ? BLACK_KING : WHITE_KING;
    
    // Direction of movement (depends on player)
    int forwardDirection = state.blackTurn ? 1 : -1;
    
    // Check if jumps are available
    bool jumpAvailable = false;
    
    // First pass: check for jumps (captures)
    for (int row = 0; row < BOARD_SIZE && moveCount < maxMoves; row++) {
      for (int col = 0; col < BOARD_SIZE && moveCount < maxMoves; col++) {
        if (state.board[row][col] == player || state.board[row][col] == king) {
          // Check all four diagonal directions for jumps
          for (int dRow = -1; dRow <= 1; dRow += 2) {
            for (int dCol = -1; dCol <= 1; dCol += 2) {
              // Regular pieces can only move forward, kings can move any direction
              if (state.board[row][col] == player && dRow != forwardDirection) {
                continue;
              }
              
              // Check if jump is valid
              int jumpRow = row + dRow;
              int jumpCol = col + dCol;
              int landRow = row + 2 * dRow;
              int landCol = col + 2 * dCol;
              
              if (landRow >= 0 && landRow < BOARD_SIZE && landCol >= 0 && landCol < BOARD_SIZE) {
                byte jumpPiece = state.board[jumpRow][jumpCol];
                
                // Can only jump opponent's pieces
                bool isOpponent = false;
                if (state.blackTurn) {
                  isOpponent = (jumpPiece == WHITE || jumpPiece == WHITE_KING);
                } else {
                  isOpponent = (jumpPiece == BLACK || jumpPiece == BLACK_KING);
                }
                
                if (isOpponent && state.board[landRow][landCol] == EMPTY) {
                  moves[moveCount] = CheckersMove(row, col, landRow, landCol);
                  moveCount++;
                  jumpAvailable = true;
                }
              }
            }
          }
        }
      }
    }
    
    // If jumps are available, they are mandatory - return only jumps
    if (jumpAvailable) {
      return moveCount;
    }
    
    // Second pass: if no jumps, consider regular moves
    moveCount = 0;
    for (int row = 0; row < BOARD_SIZE && moveCount < maxMoves; row++) {
      for (int col = 0; col < BOARD_SIZE && moveCount < maxMoves; col++) {
        if (state.board[row][col] == player || state.board[row][col] == king) {
          // Check the two forward diagonal directions for regular moves
          for (int dCol = -1; dCol <= 1; dCol += 2) {
            // Regular pieces can only move forward, kings can move in any direction
            int startDir = (state.board[row][col] == king) ? -1 : forwardDirection;
            int endDir = (state.board[row][col] == king) ? 1 : forwardDirection;
            
            for (int dRow = startDir; dRow <= endDir; dRow += 2) {
              int toRow = row + dRow;
              int toCol = col + dCol;
              
              if (toRow >= 0 && toRow < BOARD_SIZE && toCol >= 0 && toCol < BOARD_SIZE) {
                if (state.board[toRow][toCol] == EMPTY) {
                  moves[moveCount] = CheckersMove(row, col, toRow, toCol);
                  moveCount++;
                }
              }
            }
          }
        }
      }
    }
    
    return moveCount;
  }
  
  // Apply a move to a state, modifying the state
  void applyMove(CheckersState& state, const CheckersMove& move) override {
    // Move the piece
    byte piece = state.board[move.fromRow][move.fromCol];
    state.board[move.fromRow][move.fromCol] = EMPTY;
    state.board[move.toRow][move.toCol] = piece;
    
    // If this is a jump, remove the captured piece
    if (move.isJump) {
      state.board[move.jumpRow][move.jumpCol] = EMPTY;
    }
    
    // Check for promotion to king
    if (piece == WHITE && move.toRow == 0) {
      state.board[move.toRow][move.toCol] = WHITE_KING;
    } else if (piece == BLACK && move.toRow == BOARD_SIZE - 1) {
      state.board[move.toRow][move.toCol] = BLACK_KING;
    }
    
    // Switch turns
    state.blackTurn = !state.blackTurn;
  }
  
  // Check if the game has reached a terminal state (win/loss/draw)
  bool isTerminal(const CheckersState& state) override {
    // Check if any moves are available for the current player
    CheckersMove moves[MAX_MOVES];
    int moveCount = generateMoves(state, moves, MAX_MOVES);
    
    if (moveCount == 0) {
      return true; // No moves available, game over
    }
    
    // Check for piece count
    int whitePieces = 0;
    int blackPieces = 0;
    
    for (int row = 0; row < BOARD_SIZE; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        if (state.board[row][col] == WHITE || state.board[row][col] == WHITE_KING) {
          whitePieces++;
        } else if (state.board[row][col] == BLACK || state.board[row][col] == BLACK_KING) {
          blackPieces++;
        }
      }
    }
    
    if (whitePieces == 0 || blackPieces == 0) {
      return true; // One player has no pieces left
    }
    
    return false;
  }
  
  // Check if the current player is the maximizing player
  bool isMaximizingPlayer(const CheckersState& state) override {
    // White is maximizing player
    return !state.blackTurn;
  }
};

// Global variables
CheckersState gameState;
CheckersLogic gameLogic;
Minimax<CheckersState, CheckersMove, MAX_MOVES, MINIMAX_DEPTH> minimaxAI(gameLogic);

int gameMode = MODE_HUMAN_VS_AI;  // Default to Human vs AI

// Function to display the board
void displayBoard(const CheckersState& state) {
  Serial.println("\n    0  1  2  3  4  5  6  7 ");
  Serial.println("  +------------------------+");
  
  for (int row = 0; row < BOARD_SIZE; row++) {
    Serial.print(row);
    Serial.print(" |");
    
    for (int col = 0; col < BOARD_SIZE; col++) {
      switch (state.board[row][col]) {
        case EMPTY:
          // Use 3-character width consistently
          Serial.print((row + col) % 2 == 0 ? " . " : "   ");
          break;
        case WHITE:
          Serial.print(" w ");
          break;
        case BLACK:
          Serial.print(" b ");
          break;
        case WHITE_KING:
          Serial.print(" W ");
          break;
        case BLACK_KING:
          Serial.print(" B ");
          break;
      }
    }
    
    Serial.println("|");
  }
  
  Serial.println("  +------------------------+");
  Serial.print(state.blackTurn ? "Black's turn" : "White's turn");
  Serial.println();
}

// Function to get a move from human player
CheckersMove getHumanMove() {
  CheckersMove move;
  bool validMove = false;
  
  while (!validMove) {
    // Prompt for input
    Serial.println("Enter your move (fromRow fromCol toRow toCol):");
    
    // Wait for input
    while (!Serial.available()) {
      delay(100);
    }
    
    // Read the move
    move.fromRow = Serial.parseInt();
    move.fromCol = Serial.parseInt();
    move.toRow = Serial.parseInt();
    move.toCol = Serial.parseInt();
    
    // Clear the input buffer
    while (Serial.available()) {
      Serial.read();
    }
    
    // Calculate jump information
    if (abs(move.toRow - move.fromRow) == 2) {
      move.isJump = true;
      move.jumpRow = (move.fromRow + move.toRow) / 2;
      move.jumpCol = (move.fromCol + move.toCol) / 2;
    }
    
    // Validate move
    CheckersMove moves[MAX_MOVES];
    int moveCount = gameLogic.generateMoves(gameState, moves, MAX_MOVES);
    
    for (int i = 0; i < moveCount; i++) {
      CheckersMove &m = moves[i];
      if (m.fromRow == move.fromRow && m.fromCol == move.fromCol && 
          m.toRow == move.toRow && m.toCol == move.toCol) {
        validMove = true;
        break;
      }
    }
    
    if (!validMove) {
      Serial.println("Invalid move. Try again.");
    }
  }
  
  return move;
}

// Function to get AI move
CheckersMove getAIMove() {
  Serial.println("AI is thinking...");
  
  unsigned long startTime = millis();
  CheckersMove move = minimaxAI.findBestMove(gameState);
  unsigned long endTime = millis();
  
  Serial.print("AI move: ");
  Serial.print(move.fromRow);
  Serial.print(",");
  Serial.print(move.fromCol);
  Serial.print(" to ");
  Serial.print(move.toRow);
  Serial.print(",");
  Serial.println(move.toCol);
  
  Serial.print("Nodes searched: ");
  Serial.println(minimaxAI.getNodesSearched());
  
  Serial.print("Time: ");
  Serial.print((endTime - startTime) / 1000.0);
  Serial.println(" seconds");
  
  return move;
}

// Function to check for game over
bool checkGameOver() {
  if (gameLogic.isTerminal(gameState)) {
    displayBoard(gameState);
    
    // Count pieces to determine winner
    int whitePieces = 0;
    int blackPieces = 0;
    
    for (int row = 0; row < BOARD_SIZE; row++) {
      for (int col = 0; col < BOARD_SIZE; col++) {
        if (gameState.board[row][col] == WHITE || gameState.board[row][col] == WHITE_KING) {
          whitePieces++;
        } else if (gameState.board[row][col] == BLACK || gameState.board[row][col] == BLACK_KING) {
          blackPieces++;
        }
      }
    }
    
    if (whitePieces > blackPieces) {
      Serial.println("White wins!");
    } else if (blackPieces > whitePieces) {
      Serial.println("Black wins!");
    } else {
      Serial.println("Game ended in a draw!");
    }
    
    Serial.println("Enter 'r' to restart or 'm' to change mode.");
    return true;
  }
  
  return false;
}

// Function to handle game setup and restart
void setupGame() {
  gameState.init();
  
  Serial.println("\n=== CHECKERS GAME ===");
  Serial.println("Game Modes:");
  Serial.println("1. Human (Black) vs. AI (White)");
  Serial.println("2. AI vs. AI");
  Serial.println("Select mode (1-2):");
  
  while (!Serial.available()) {
    delay(100);
  }
  
  char choice = Serial.read();
  
  // Clear the input buffer
  while (Serial.available()) {
    Serial.read();
  }
  
  if (choice == '2') {
    gameMode = MODE_AI_VS_AI;
    Serial.println("AI vs. AI mode selected.");
  } else {
    gameMode = MODE_HUMAN_VS_AI;
    Serial.println("Human vs. AI mode selected.");
    Serial.println("You play as Black, AI plays as White.");
  }
}

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for serial port to connect
  }
  
  randomSeed(analogRead(A0));
  setupGame();
}

void loop() {
  // Display the current board state
  displayBoard(gameState);
  
  if (checkGameOver()) {
    while (!Serial.available()) {
      delay(100);
    }
    
    char choice = Serial.read();
    
    // Clear input buffer
    while (Serial.available()) {
      Serial.read();
    }
    
    if (choice == 'r') {
      setupGame();
    } else if (choice == 'm') {
      gameMode = (gameMode == MODE_HUMAN_VS_AI) ? MODE_AI_VS_AI : MODE_HUMAN_VS_AI;
      setupGame();
    }
    return;
  }
  
  // Get and apply move based on game mode and current player
  CheckersMove move;
  
  if (gameMode == MODE_HUMAN_VS_AI) {
    if (gameState.blackTurn) {
      // Human's turn (Black)
      move = getHumanMove();
    } else {
      // AI's turn (White)
      move = getAIMove();
      delay(1000); // Small delay to make AI moves visible
    }
  } else {
    // AI vs. AI mode
    move = getAIMove();
    delay(2000); // Longer delay to observe the game
  }
  
  // Apply the move
  gameLogic.applyMove(gameState, move);
}

r/Arduino_AI • • Feb 25 '25

Look What I Made! APM GPT – Now Supports Very Large Projects

1 Upvotes

The Arduino Project Manager has been refactored to now use a just-in-time file retrieval approach so that the responses to openAI don't overwhelm the conversation. Here's a demo of today's enhancements and features.

Have fun!

ripred


r/Arduino_AI • • Feb 24 '25

APM GPT New Featurs: Library and Board Management, Installing, and Updating

1 Upvotes

Cheers!
ripred


r/Arduino_AI • • Feb 21 '25

Using the APM GPT To Write a Sketch from Scratch

1 Upvotes

This all takes place live on my local hard drive and Arduino Nano. All of the files are left there for me to do whatever I want with, either open them in the real IDE, or chat more with the gpt to enhance it some more heh...


r/Arduino_AI • • Feb 09 '25

Dialog Another Attempt to Generate More Starter Kit Guides for Kits with bad Docs

1 Upvotes

https://chatgpt.com/share/67a85ff0-dddc-800e-8083-7ecf6c173ad7

Note that it can't count to 50 apparently. But this was using another model (o3-mini-high vs o1 Pro).


r/Arduino_AI • • Dec 17 '24

openAI api On the 9th day of "12 Days of OpenAI"...

1 Upvotes

r/Arduino_AI • • Dec 05 '24

Wanna Hire someone for Arduino coding (contain ESP32 cam, Ai model trained by EdgeImpulse)

1 Upvotes

Hyy, I am looking for someone who can help me in Arduino coding for a project. Someone with expertise in this area (plss only if you have expertise). I am trying to integrate AI model trained by edge impulse on Esp32cam. Basically, ESp32cam will take an image and send it as input to Ai model and on basis of output we will do some tasks


r/Arduino_AI • • Apr 22 '24

AI reading Neo R6 gps output

1 Upvotes

How do i find an AI that can read neo r6 gos output and tell the user their location based on the data given

If there isn’t something like that available, how would I make my own


r/Arduino_AI • • Feb 22 '24

esp32

1 Upvotes

I have this code that uses an ESP32-CAM for face recognition and when a smile is detected it takes a capture and sends it to my phone via Line notifications. I want to modify the code so that it sends a capture via Line when a face is detected. Can I have some help please?

//Line Notify (Smile)
    if (P1=="happy" || P1=="neutral" || P1=="sad" || P1=="angry" || P1=="fearful"  || P1=="disgusted"|| P1=="surprised") {
      Serial.println("");
      sendCapturedImage2LineNotify(lineNotifyToken);
    }
  } else if (cmd=="resetwifi") {  //重設網路連線  
    for (int i=0;i<2;i++) {
      WiFi.begin(P1.c_str(), P2.c_str());
      Serial.print("Connecting to ");
      Serial.println(P1);
      long int StartTime=millis();
      while (WiFi.status() != WL_CONNECTED) {
          delay(500);
          if ((StartTime+5000) < millis()) break;
      } 
      Serial.println("");
      Serial.println("STAIP: "+WiFi.localIP().toString());
      Feedback="STAIP: "+WiFi.localIP().toString();

      if (WiFi.status() == WL_CONNECTED) {
        WiFi.softAP((WiFi.localIP().toString()+"_"+P1).c_str(), P2.c_str());
        for (int i=0;i<2;i++) {    //若連不上WIFI設定閃光燈慢速閃爍
          ledcWrite(4,10);
          delay(300);
          ledcWrite(4,0);
          delay(300);    
        }
        break;
      }
    }
  } else if (cmd=="framesize") {
    int val = P1.toInt();
    sensor_t * s = esp_camera_sensor_get(); 
    s->set_framesize(s, (framesize_t)val);    
  } else if (cmd=="quality") { //畫質
    sensor_t * s = esp_camera_sensor_get();
    s->set_quality(s, P1.toInt());     
  } else if (cmd=="contrast") {  //對比
    sensor_t * s = esp_camera_sensor_get();
    s->set_contrast(s, P1.toInt());          
  } else if (cmd=="brightness") {  //亮度
    sensor_t * s = esp_camera_sensor_get();
    s->set_brightness(s, P1.toInt());   
  } else if (cmd=="saturation") {  //飽和度
    sensor_t * s = esp_camera_sensor_get();
    s->set_saturation(s, P1.toInt());          
  } else if (cmd=="special_effect") {  //特效
    sensor_t * s = esp_camera_sensor_get();
    s->set_special_effect(s, P1.toInt());  
  } else if (cmd=="hmirror") {  //水平鏡像
    sensor_t * s = esp_camera_sensor_get();
    s->set_hmirror(s, P1.toInt());  
  } else if (cmd=="vflip") {  //垂直翻轉
    sensor_t * s = esp_camera_sensor_get();
    s->set_vflip(s, P1.toInt());  
  } else {
    Feedback="Command is not defined.";
  }
  if (Feedback=="") Feedback=Command;  
}

//拆解命令字串置入變數
void getCommand(char c)
{
  if (c=='?') ReceiveState=1;
  if ((c==' ')||(c=='\r')||(c=='\n')) ReceiveState=0;
  
  if (ReceiveState==1)
  {
    Command=Command+String(c);
    
    if (c=='=') cmdState=0;
    if (c==';') strState++;
  
    if ((cmdState==1)&&((c!='?')||(questionstate==1))) cmd=cmd+String(c);
    if ((cmdState==0)&&(strState==1)&&((c!='=')||(equalstate==1))) P1=P1+String(c);
    if ((cmdState==0)&&(strState==2)&&(c!=';')) P2=P2+String(c);
    if ((cmdState==0)&&(strState==3)&&(c!=';')) P3=P3+String(c);
    if ((cmdState==0)&&(strState==4)&&(c!=';')) P4=P4+String(c);
    if ((cmdState==0)&&(strState==5)&&(c!=';')) P5=P5+String(c);
    if ((cmdState==0)&&(strState==6)&&(c!=';')) P6=P6+String(c);
    if ((cmdState==0)&&(strState==7)&&(c!=';')) P7=P7+String(c);
    if ((cmdState==0)&&(strState==8)&&(c!=';')) P8=P8+String(c);
    if ((cmdState==0)&&(strState>=9)&&((c!=';')||(semicolonstate==1))) P9=P9+String(c);
        const aiView = document.getElementById('stream')
        const aiStill = document.getElementById('get-still')
        const canvas = document.getElementById('canvas')     
        var context = canvas.getContext("2d");  
        const message = document.getElementById('message');
        const uart = document.getElementById('uart');
        const chkResult = document.getElementById('chkResult');
        const probability = document.getElementById('probability')
        var res = "";

        //Model: https://github.com/fustyles/webduino/tree/master/TensorFlow/Face-api
        const modelPath = 'https://fustyles.github.io/webduino/TensorFlow/Face-api/';
        let currentStream;
        let displaySize = { width:320, height: 240 }
        let faceDetection;
        
        Promise.all([
          faceapi.nets.tinyFaceDetector.load(modelPath),
          faceapi.nets.faceLandmark68TinyNet.load(modelPath),
          faceapi.nets.faceRecognitionNet.load(modelPath),
          faceapi.nets.faceExpressionNet.load(modelPath),
          faceapi.nets.ageGenderNet.load(modelPath)          
        ]).then(function(){
          message.innerHTML = "";
          aiStill.click();
        })  
        
        async function DetectImage() {
          canvas.setAttribute("width", aiView.width);
          canvas.setAttribute("height", aiView.height);
          context.drawImage(aiView, 0, 0, aiView.width, aiView.height); 
          if (!chkResult.checked) message.innerHTML = "";
                
          const detections = await faceapi.detectAllFaces(canvas, new faceapi.TinyFaceDetectorOptions()).withFaceLandmarks(true).withFaceExpressions().withAgeAndGender()
          const resizedDetections = faceapi.resizeResults(detections, displaySize)
          faceapi.draw.drawDetections(canvas, resizedDetections)
          faceapi.draw.drawFaceLandmarks(canvas, resizedDetections)
          faceapi.draw.drawFaceExpressions(canvas, resizedDetections)
          resizedDetections.forEach(result => {
            const { detection,expressions,gender,genderProbability,age } = result
            //message.innerHTML = JSON.stringify(result);

            res = "";
            var i=0;
            var maxEmotion="neutral";
            var maxProbability=expressions.neutral;
            if (expressions.happy>maxProbability) {
              maxProbability=expressions.happy;
              maxEmotion="happy";
            }
            if (expressions.sad>maxProbability) {
              maxProbability=expressions.sad;
              maxEmotion="sad";
            }
            if (expressions.angry>maxProbability) {
              maxProbability=expressions.angry;
              maxEmotion="angry";
            }
            if (expressions.fearful>maxProbability) {
              maxProbability=expressions.fearful;
              maxEmotion="fearful";
            }
            if (expressions.disgusted>maxProbability) {
              maxProbability=expressions.disgusted;
              maxEmotion="disgusted";
            }
            if (expressions.surprised>maxProbability) {
              maxProbability=expressions.surprised;
              maxEmotion="surprised";
            }

            if (uart.checked) {
              //當可能性最大的表情是happy時
              //if ((maxEmotion=="happy"||maxEmotion="neutral"||maxEmotion="sad" ||maxEmotion="angry" ||maxEmotion="fearful" ||maxEmotion="disgusted" ||maxEmotion="surprised")&&maxProbability>=Number(probability.value)) {
              if (maxEmotion=="happy" &&maxProbability>=Number(probability.value)) {
                var query = document.location.origin+'?uart='+maxEmotion;
                fetch(query)
                  .then(response => {
                    console.log(`request to ${query} finished, status: ${response.status}`)
                  })              
              }
            }
            
            res+= i+",age,"+Math.round(age)+",gender,"+gender+",genderProbability,"+Math.round(genderProbability)+",emotion,"+maxEmotion+",neutral,"+Math.round(expressions.neutral)+",happy,"+Math.round(expressions.happy)+",sad,"+Math.round(expressions.sad)+",angry,"+Math.round(expressions.angry)+",fearful,"+Math.round(expressions.fearful)+",disgusted,"+Math.round(expressions.disgusted)+",surprised,"+Math.round(expressions.surprised)+",boxX,"+Math.round(detection._box._x)+",boxY,"+Math.round(detection._box._y)+",boxWidth,"+Math.round(detection._box._width)+",boxHeight,"+Math.round(detection._box._height)+"<br>";
            i++;        
            new faceapi.draw.DrawTextField(
              [
                `${faceapi.round(age, 0)} years`,
                `${gender} (${faceapi.round(genderProbability)})`
              ],
              result.detection.box.bottomRight
            ).draw(canvas)
          })
          
          if (chkResult.checked) message.innerHTML = res;
          aiStill.click();
        }
        
        aiView.onload = function (event) {
          try { 
            document.createEvent("TouchEvent");
            setTimeout(function(){DetectImage();},250);
          } catch(e) { 
            setTimeout(function(){DetectImage();},150);
          } 
        }
        
        //官方式函式
        function start() {
          var baseHost = 'http://'+document.getElementById("ip").value;  //var baseHost = document.location.origin
   
          const hide = el => {
            el.classList.add('hidden')
          }
          
          const show = el => {
            el.classList.remove('hidden')
          }
        
          const disable = el => {
            el.classList.add('disabled')
            el.disabled = true
          }
        
          const enable = el => {
            el.classList.remove('disabled')
            el.disabled = false
          }
        
          const updateValue = (el, value, updateRemote) => {
            updateRemote = updateRemote == null ? true : updateRemote
            let initialValue
            if(!el) return;
            if (el.type === 'checkbox') {
              initialValue = el.checked
              value = !!value
              el.checked = value
            } else {
              initialValue = el.value
              el.value = value
            }
        
            if (updateRemote && initialValue !== value) {
              updateConfig(el);
            } 
          }
        
          function updateConfig (el) {
            let value
            switch (el.type) {
              case 'checkbox':
                value = el.checked ? 1 : 0
                break
              case 'range':
              case 'select-one':
                value = el.value
                break
              case 'button':
              case 'submit':
                value = '1'
                break
              default:
                return
            }
        
            if (el.id =="flash") {  //新增flash自訂指令
              var query = baseHost+"?flash=" + String(value);
            } else if (el.id =="servo") {  //新增servo自訂指令
              var query = baseHost+"?servo=" + pinServo.value + ";" + String(value);
            } else if (el.id =="relay") {  //新增繼電器自訂指令
              var query = baseHost+"?relay=" + pinRelay.value + ";" + Number(relay.checked);
            } else if (el.id =="uart") {  //新增uart自訂指令
              return;
            } else if (el.id =="probability") {  //新增probability自訂指令
              return;                                          
            } else {
              var query = `${baseHost}/?${el.id}=${value}`
            }
        
            fetch(query)
              .then(response => {
                console.log(`request to ${query} finished, status: ${response.status}`)
              })
          }
        
          document
            .querySelectorAll('.close')
            .forEach(el => {
              el.onclick = () => {
                hide(el.parentNode)
              }
            })
        
          const view = document.getElementById('stream')
          const viewContainer = document.getElementById('stream-container')
          const stillButton = document.getElementById('get-still')
          const enrollButton = document.getElementById('face_enroll')
          const closeButton = document.getElementById('close-stream')
          const stopButton = document.getElementById('stop-still')            //新增stopButton變數
          const restartButton = document.getElementById('restart')            //新增restart變數
          const flash = document.getElementById('flash')                      //新增flash變數
          const servo = document.getElementById('servo')                      //新增servo變數
          const pinServo = document.getElementById('pinServo');               //新增servo pin變數
          const relay = document.getElementById('relay')                      //新增relay變數
          const pinRelay = document.getElementById('pinRelay');               //新增relay pin變數          
          const uart = document.getElementById('uart')                        //新增uart變數
          var myTimer;
          var restartCount=0;    
          var streamState = false;
          
          stopButton.onclick = function (event) {   
            window.stop();
            message.innerHTML = "";
          }    
           
          // Attach actions to buttons
          stillButton.onclick = () => {
            view.src = `${baseHost}/?getstill=${Date.now()}`
            show(viewContainer);     
          }
          
          closeButton.onclick = () => {
            hide(viewContainer)
          }
          
          //新增重啟電源按鈕點選事件 (自訂指令格式:http://192.168.xxx.xxx/?cmd=P1;P2;P3;P4;P5;P6;P7;P8;P9)
          restartButton.onclick = () => {
            fetch(baseHost+"/?restart");
          }    
                
          // Attach default on change action
          document
            .querySelectorAll('.default-action')
            .forEach(el => {
              el.onchange = () => updateConfig(el)
            })
        
          framesize.onchange = () => {
            updateConfig(framesize)
          }
          
          // read initial values  
          fetch(`${baseHost}/?status`)
          .then(function (response) {
            return response.json()
          })
          .then(function (state) {
            document
            .querySelectorAll('.default-action')
            .forEach(el => {
              if (el.id=="flash") {  //新增flash設定預設值0
                flash.value=0;
                var query = baseHost+"?flash=0";
                fetch(query)
                  .then(response => {
                    console.log(`request to ${query} finished, status: ${response.status}`)
                  })
              } else if (el.id=="servo") {  //新增servo設定預設值90度
                servo.value=90;
                /*
                var query = baseHost+"?servo=" + pinServo.value + ";90";
                fetch(query)
                  .then(response => {
                    console.log(`request to ${query} finished, status: ${response.status}`)
                  })
                */
              } else if (el.id=="relay") {  //新增relay設定預設值0
                relay.checked = false;
                /*
                var query = baseHost+"?relay=" + pinRelay.value + ";0";
                fetch(query)
                  .then(response => {
                    console.log(`request to ${query} finished, status: ${response.status}`)
                  })
                */
              } else if (el.id=="uart") {  //新增uart設定預設值0
                uart.checked = false;
              } else if (el.id=="probability") {  //新增probability設定預設值0
                probability.value = 0;                                  
              } else {    
                updateValue(el, state[el.id], false)
              }
            })
          })
        }
        
        //  網址/?192.168.1.38  可自動帶入?後參數IP值
        var href=location.href;
        if (href.indexOf("?")!=-1) {
          ip.value = location.search.split("?")[1].replace(/http:\/\//g,"");
          start();
        }
        else if (href.indexOf("http")!=-1) {
          ip.value = location.host;
          start();
        }
          
    </script>        
    </body>
</html>
)rawliteral";

//設定選單初始值取回json格式
void status(){
  //回傳視訊狀態
  sensor_t * s = esp_camera_sensor_get();
  String json = "{";
  json += "\"framesize\":"+String(s->status.framesize)+",";
  json += "\"quality\":"+String(s->status.quality)+",";
  json += "\"brightness\":"+String(s->status.brightness)+",";
  json += "\"contrast\":"+String(s->status.contrast)+",";
  json += "\"saturation\":"+String(s->status.saturation)+",";
  json += "\"special_effect\":"+String(s->status.special_effect)+",";
  json += "\"vflip\":"+String(s->status.vflip)+",";
  json += "\"hmirror\":"+String(s->status.hmirror);
  json += "}";
  
  client.println("HTTP/1.1 200 OK");
  client.println("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
  client.println("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
  client.println("Content-Type: application/json; charset=utf-8");
  client.println("Access-Control-Allow-Origin: *");
  client.println("Connection: close");
  client.println();
  
  for (int Index = 0; Index < json.length(); Index = Index+1024) {
    client.print(json.substring(Index, Index+1024));
  }
}

void mainpage() {
  //回傳HTML首頁或Feedback
  client.println("HTTP/1.1 200 OK");
  client.println("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
  client.println("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
  client.println("Content-Type: text/html; charset=utf-8");
  client.println("Access-Control-Allow-Origin: *");
  client.println("Connection: close");
  client.println();
  
  String Data="";
  if (cmd!="")
    Data = Feedback;
  else
    Data = String((const char *)INDEX_HTML);
  
  for (int Index = 0; Index < Data.length(); Index = Index+1024) {
    client.print(Data.substring(Index, Index+1024));
  } 
}

void getStill() {
  //回傳JPEG格式影像
  camera_fb_t * fb = NULL;
  fb = esp_camera_fb_get();  
  if(!fb) {
    Serial.println("Camera capture failed");
    delay(1000);
    ESP.restart();
  }

  client.println("HTTP/1.1 200 OK");
  client.println("Access-Control-Allow-Origin: *");              
  client.println("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
  client.println("Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS");
  client.println("Content-Type: image/jpeg");
  client.println("Content-Disposition: form-data; name=\"imageFile\"; filename=\"picture.jpg\""); 
  client.println("Content-Length: " + String(fb->len));             
  client.println("Connection: close");
  client.println();
  
  uint8_t *fbBuf = fb->buf;
  size_t fbLen = fb->len;
  for (size_t n=0;n<fbLen;n=n+1024) {
    if (n+1024<fbLen) {
      client.write(fbBuf, 1024);
      fbBuf += 1024;
    }
    else if (fbLen%1024>0) {
      size_t remainder = fbLen%1024;
      client.write(fbBuf, remainder);
    }
  }  
  esp_camera_fb_return(fb);

  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);              
}

String sendCapturedImage2LineNotify(String token) {
  camera_fb_t * fb = NULL;
  fb = esp_camera_fb_get();  
  if(!fb) {
    Serial.println("Camera capture failed");
    delay(1000);
    ESP.restart();
    return "Camera capture failed";
  }
   
  WiFiClientSecure client_tcp;
  client_tcp.setInsecure();   //run version 1.0.5 or above
  Serial.println("Connect to notify-api.line.me");
  if (client_tcp.connect("notify-api.line.me", 443)) {
    Serial.println("Connection successful");
    
    String message = "ESP32-CAM";
    String head = "--Taiwan\r\nContent-Disposition: form-data; name=\"message\"; \r\n\r\n" + message + "\r\n--Taiwan\r\nContent-Disposition: form-data; name=\"imageFile\"; filename=\"esp32-cam.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n";
    String tail = "\r\n--Taiwan--\r\n";

    uint16_t imageLen = fb->len;
    uint16_t extraLen = head.length() + tail.length();
    uint16_t totalLen = imageLen + extraLen;
  
    client_tcp.println("POST /api/notify HTTP/1.1");
    client_tcp.println("Connection: close"); 
    client_tcp.println("Host: notify-api.line.me");
    client_tcp.println("Authorization: Bearer " + token);
    client_tcp.println("Content-Length: " + String(totalLen));
    client_tcp.println("Content-Type: multipart/form-data; boundary=Taiwan");
    client_tcp.println();
    client_tcp.print(head);
    
    uint8_t *fbBuf = fb->buf;
    size_t fbLen = fb->len;
    for (size_t n=0;n<fbLen;n=n+1024) {
      if (n+1024<fbLen) {
        client_tcp.write(fbBuf, 1024);
        fbBuf += 1024;
      }
      else if (fbLen%1024>0) {
        size_t remainder = fbLen%1024;
        client_tcp.write(fbBuf, remainder);
      }
    }  
    
    client_tcp.print(tail);
    esp_camera_fb_return(fb);

    String getResponse="",Feedback="";
    int waitTime = 10000;   // timeout 10 seconds
    long startTime = millis();
    boolean state = false;
    
    while ((startTime + waitTime) > millis()) {
      Serial.print(".");
      delay(100);      
      while (client_tcp.available())  {
          char c = client_tcp.read();
          if (state==true) Feedback += String(c);        
          if (c == '\n') {
            if (getResponse.length()==0) state=true; 
            getResponse = "";
          } 
          else if (c != '\r')
            getResponse += String(c);
          startTime = millis();
       }
       if (Feedback.length()>0) break;
    }
    Serial.println();
    client_tcp.stop();
    return Feedback;
  }
  else {
    return "Connected to notify-api.line.me failed.";
  }
}

r/Arduino_AI • • Feb 20 '24

seesdadw

1 Upvotes

can someone help me program an reverse vending machine?? codes??


r/Arduino_AI • • Dec 26 '23

TCS230 TCS3200 Color Recognition Sensor Detector Module #arduino #diy #arduinoproject

Thumbnail
youtube.com
1 Upvotes

r/Arduino_AI • • Jul 21 '23

Arduino and GPT Function Calling

Thumbnail self.arduino
1 Upvotes

r/Arduino_AI • • Jul 21 '23

Humor light autonomous machinery

Thumbnail
youtube.com
1 Upvotes

r/Arduino_AI • • May 26 '23

MicroChess updated for Uno R4 Minima Compataibility

Thumbnail
self.arduino
1 Upvotes

r/Arduino_AI • • May 24 '23

Code Help [HELP NEEDED] I need someone to help me make the code for electronic differential

1 Upvotes

Items available: potentiometer, 2 TT motors(1 for each wheel), H-bridge and Arduino Uno board.

I need to make the program so that when I turn my steering wheel (potentiometer) to the left, my left wheel (TT motor) makes rotations(turns) slower and my right wheel (TT motor) turns faster and vice versa. I have no idea how to program it. It should work like an electronic differential


r/Arduino_AI • • Apr 07 '23

Want to do dev board AI

1 Upvotes

I've finally got some questions I'd like to ask AI, and I know where data sets exist.

One set is historical stock market data. And there's some camera stuff I can conceptualize.

I want to mess with FPGA, but I'm not even sure I have those letters in the right order. I want to get a Xilinx board or something, but I don't know how I'd program it.

Is anybody aware of an online resource for this base-level AI stuff for people who want to get hands on?


r/Arduino_AI • • Mar 29 '23

MicroChess Update: Money for Nothing..

Thumbnail self.arduino
1 Upvotes

r/Arduino_AI • • Mar 27 '23

MicroChess - Move Evaluation Function

Thumbnail
self.arduino
1 Upvotes

r/Arduino_AI • • Feb 22 '23

r/Arduino_AI Lounge

1 Upvotes

A place for members of r/Arduino_AI to chat with each other