GithubHelp home page GithubHelp logo

cs301_interrogator's People

Contributors

maxwell142857 avatar zhou-yicheng avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cs301_interrogator's Issues

Judging mode

int mode =0;
int this_point = 0;
int total_point = 0;
static unsigned char sample_ans[100] = {0};
int judge = 0;
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if(huart->Instance==USART1){
static unsigned char uRx_Data[1024] = {0};
static unsigned char uLength = 0;
if(rxBuffer[0] == '\n'){
if(mode == 2){
if(judge == 0){
if(strcmp(sample_ans, uRx_Data)==0){
total_point = this_point + total_point;
this_point = 0;
}
HAL_UART_Transmit(&huart1, "current total mark: ", 20, HAL_MAX_DELAY);
HAL_UART_Transmit(&huart1, total_point, 10, HAL_MAX_DELAY);
HAL_UART_Transmit(&huart1, "\r\n", 2, HAL_MAX_DELAY);
HAL_UART_Transmit(&huart1, " [Next Question:n]/[End the round:e]", 20, HAL_MAX_DELAY);
judge = 1;
}else{
if(strcmp(uRx_Data, "n\r")==0){
mode = 0;
judge =0;
}else if(strcmp(uRx_Data, "e\r")==0){
mode = 3;//end
judge = 0;
}

			}
		}


		for(int i = 0;i<uLength;i++){
			uRx_Data[i]=0;
		}
		uLength = 0;
	}else{
		uRx_Data[uLength] = rxBuffer[0];
		uLength++;
	}
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.